gearheads
/
mastodon
Archived
2
0
Fork 0

Fix error when changing ACL on missing objects during suspension (#15420)

gh/stable
Eugen Rochko 2020-12-24 15:53:45 +01:00 committed by GitHub
parent ba0b79fc5c
commit e89648574f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -70,7 +70,11 @@ class SuspendAccountService < BaseService
styles.each do |style| styles.each do |style|
case Paperclip::Attachment.default_options[:storage] case Paperclip::Attachment.default_options[:storage]
when :s3 when :s3
begin
attachment.s3_object(style).acl.put(acl: 'private') 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 when :fog
# Not supported # Not supported
when :filesystem when :filesystem

View File

@ -61,7 +61,11 @@ class UnsuspendAccountService < BaseService
styles.each do |style| styles.each do |style|
case Paperclip::Attachment.default_options[:storage] case Paperclip::Attachment.default_options[:storage]
when :s3 when :s3
begin
attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions]) 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 when :fog
# Not supported # Not supported
when :filesystem when :filesystem