about summary refs log tree commit diff
path: root/app/services/suspend_account_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/suspend_account_service.rb')
-rw-r--r--app/services/suspend_account_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb
index 19d65280d..9f4da91d4 100644
--- a/app/services/suspend_account_service.rb
+++ b/app/services/suspend_account_service.rb
@@ -65,10 +65,16 @@ class SuspendAccountService < BaseService
         attachment = media_attachment.public_send(attachment_name)
         styles     = [:original] | attachment.styles.keys
 
+        next if attachment.blank?
+
         styles.each do |style|
           case Paperclip::Attachment.default_options[:storage]
           when :s3
-            attachment.s3_object(style).acl.put(acl: 'private')
+            begin
+              attachment.s3_object(style).acl.put(acl: 'private')
+            rescue Aws::S3::Errors::NoSuchKey
+              Rails.logger.warn "Tried to change acl on non-existent key #{attachment.s3_object(style).key}"
+            end
           when :fog
             # Not supported
           when :filesystem