gearheads
/
mastodon
Archived
2
0
Fork 0

Change S3 ACL in "tootctl media remove-orphans --fix-permissions" from fixed value to environment file's value. (#14715)

gh/stable
Y.Yamashiro 2020-09-02 07:17:58 +09:00 committed by GitHub
parent 79305428a7
commit abc91e5fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -67,6 +67,7 @@ module Mastodon
when :s3 when :s3
paperclip_instance = MediaAttachment.new.file paperclip_instance = MediaAttachment.new.file
s3_interface = paperclip_instance.s3_interface s3_interface = paperclip_instance.s3_interface
s3_permissions = Paperclip::Attachment.default_options[:s3_permissions]
bucket = s3_interface.bucket(Paperclip::Attachment.default_options[:s3_credentials][:bucket]) bucket = s3_interface.bucket(Paperclip::Attachment.default_options[:s3_credentials][:bucket])
last_key = options[:start_after] last_key = options[:start_after]
@ -87,7 +88,7 @@ module Mastodon
record_map = preload_records_from_mixed_objects(objects) record_map = preload_records_from_mixed_objects(objects)
objects.each do |object| objects.each do |object|
object.acl.put(acl: 'public-read') if options[:fix_permissions] && !options[:dry_run] object.acl.put(acl: s3_permissions) if options[:fix_permissions] && !options[:dry_run]
path_segments = object.key.split('/') path_segments = object.key.split('/')
path_segments.delete('cache') path_segments.delete('cache')