Skip to content

Commit

Permalink
Add --fix-permissions option to tootctl media remove-orphans (mas…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and thenameisnigel-old committed Sep 7, 2020
1 parent 02dd7f3 commit 623fc3f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mastodon/media_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def remove

option :start_after
option :prefix
option :fix_permissions, type: :boolean, default: false
option :dry_run, type: :boolean, default: false
desc 'remove-orphans', 'Scan storage and check for files that do not belong to existing media attachments'
long_desc <<~LONG_DESC
Expand Down Expand Up @@ -86,6 +87,8 @@ 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]

path_segments = object.key.split('/')
path_segments.delete('cache')

Expand Down

0 comments on commit 623fc3f

Please sign in to comment.