mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: verify the exitence of s3_object properly without db name
This commit is contained in:
parent
9a9a06e34b
commit
e12ae453e9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user