Skip to content

A platform for community discussion. Free, open, simple.

handle exceptions in s3:correct_acl task

Same2dca641c698
diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rake
index 58d12e10003..5ad2de01744 100644
--- a/lib/tasks/s3.rake
+++ b/lib/tasks/s3.rake
@@ -120,9 +120,13 @@ task 's3:correct_acl' => :environment do
if !url.start_with?(base_url)
puts "Skipping #{type} #{id} since it is not stored on s3, url is #{url}"
else
- key = url[(base_url.length + 1)..-1]
- object = Discourse.store.s3_helper.object(key)
- object.acl.put(acl: "public-read")
+ begin
+ key = url[(base_url.length + 1)..-1]
+ object = Discourse.store.s3_helper.object(key)
+ object.acl.put(acl: "public-read")
+ rescue => e
+ puts "Skipping #{type} #{id} url is #{url} #{e}"
+ end
end
if i % 100 == 0
puts "#{i} done"