diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 22e51970860eda1bb9d4d768c8a7d5c1e1c6e919..9f4da91d4c005986f23c672d3ef636359277fe96 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -70,7 +70,11 @@ class SuspendAccountService < BaseService 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 diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb index be7ad9df3e4e361340cb824f6879b4066771f7d1..ce9ee48ed11ec5771ea4f4376f09560d9dc6531c 100644 --- a/app/services/unsuspend_account_service.rb +++ b/app/services/unsuspend_account_service.rb @@ -61,7 +61,11 @@ class UnsuspendAccountService < BaseService styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 - attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions]) + begin + attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions]) + 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