Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Change S3 ACL in "tootctl media remove-orphans --fix-permissions" fro…
Browse files Browse the repository at this point in the history
…m fixed value to environment file's value. (mastodon#14715)
  • Loading branch information
Y.Yamashiro authored Sep 1, 2020
1 parent 7930542 commit abc91e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mastodon/media_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def remove_orphans
when :s3
paperclip_instance = MediaAttachment.new.file
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])
last_key = options[:start_after]

Expand All @@ -87,7 +88,7 @@ def remove_orphans
record_map = preload_records_from_mixed_objects(objects)

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.delete('cache')
Expand Down

0 comments on commit abc91e5

Please sign in to comment.