From e12ae453e98b6dff04d37b0f3de35fb0e17398b7 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan <vinothkannan@vinkas.com> Date: Wed, 29 May 2019 15:10:36 +0530 Subject: [PATCH] FIX: verify the exitence of s3_object properly without db name --- lib/tasks/uploads.rake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake index 186e2e14cfb..59998e93c67 100644 --- a/lib/tasks/uploads.rake +++ b/lib/tasks/uploads.rake @@ -395,8 +395,9 @@ def migrate_to_s3 etag = Digest::MD5.file(path).hexdigest unless skip_etag_verify key = file[file.index(prefix)..-1] key.prepend(folder) if bucket_has_folder_path + original_path = file.sub("uploads/#{db}", "") - if s3_object = s3_objects.find { |obj| file.ends_with?(obj.key) } + if s3_object = s3_objects.find { |obj| obj.key.ends_with?(original_path) } next if File.size(path) == s3_object.size && (skip_etag_verify || s3_object.etag[etag]) end @@ -417,6 +418,8 @@ def migrate_to_s3 end end + etag ||= Digest::MD5.file(path).hexdigest + if dry_run puts "#{file} => #{options[:key]}" synced += 1