diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-12-19 17:55:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 17:55:17 +0100 |
commit | c1de6730604f526a6c2d19adcf6f195352de0641 (patch) | |
tree | 7a3baba0b14c541b9dac79cf2feaeca651d47644 /app/services/suspend_account_service.rb | |
parent | 2bad619d171f8516137725c83878cdf5f6f61aa9 (diff) |
Fix suspension worker crashing on S3-compatible setups without ACL support (#22487)
Diffstat (limited to 'app/services/suspend_account_service.rb')
-rw-r--r-- | app/services/suspend_account_service.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index b8dc8d5e0..6856c2c51 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -76,10 +76,15 @@ class SuspendAccountService < BaseService styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 + # Prevent useless S3 calls if ACLs are disabled + next if ENV['S3_PERMISSION'] == '' + 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}" + rescue Aws::S3::Errors::NotImplemented => e + Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}" end when :fog # Not supported |