From ca8c5f7382c33625b1bb99cf4c73cfc48eb04dbb Mon Sep 17 00:00:00 2001 From: uppfinnarn Date: Mon, 16 Nov 2015 11:39:38 +0100 Subject: [PATCH] migrate_to_s3: check for missing local files If an image is already on S3, but not available locally (eg. if they're already migrated), `path` is nil. This crashes the task, because File.exists?(nil) is not valid. --- lib/tasks/uploads.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake index dbbf8908297..9000c9b8b98 100644 --- a/lib/tasks/uploads.rake +++ b/lib/tasks/uploads.rake @@ -134,7 +134,7 @@ def migrate_to_s3 # retrieve the path to the local file path = local.path_for(upload) # make sure the file exists locally - if !File.exists?(path) + if !path or !File.exists?(path) putc "X" next end