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

Commit 7108598

Browse files
authored
Add --fix-permissions option to tootctl media remove-orphans (mastodon#14383)
1 parent 26227c8 commit 7108598

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/mastodon/media_cli.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def remove
4747

4848
option :start_after
4949
option :prefix
50+
option :fix_permissions, type: :boolean, default: false
5051
option :dry_run, type: :boolean, default: false
5152
desc 'remove-orphans', 'Scan storage and check for files that do not belong to existing media attachments'
5253
long_desc <<~LONG_DESC
@@ -86,6 +87,8 @@ def remove_orphans
8687
record_map = preload_records_from_mixed_objects(objects)
8788

8889
objects.each do |object|
90+
object.acl.put(acl: 'public-read') if options[:fix_permissions] && !options[:dry_run]
91+
8992
path_segments = object.key.split('/')
9093
path_segments.delete('cache')
9194

0 commit comments

Comments
 (0)