handle exceptions in s3:correct_acl task

handle exceptions in s3:correct_acl task

We need to handle arbitrary exceptions in this task, especially since the
task is not easily resumable.

Simply output problem uploads as you hit them for now.

diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rake
index 58d12e1..5ad2de0 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"

GitHub
sha: e2dca641