about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-09-01 03:33:21 +0200
committerGitHub <noreply@github.com>2020-09-01 03:33:21 +0200
commit71085987e87df11c4e96a646182defcb5b68e31a (patch)
treefed20d4c8dc71b8c25ff79f358f6a33c73b7bafa /lib
parent26227c8e60d544be435cb410669f3c94dc71ccaa (diff)
Add `--fix-permissions` option to `tootctl media remove-orphans` (#14383)
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/media_cli.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb
index 54da5b2cd..31135f7fc 100644
--- a/lib/mastodon/media_cli.rb
+++ b/lib/mastodon/media_cli.rb
@@ -47,6 +47,7 @@ module Mastodon
 
     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
@@ -86,6 +87,8 @@ module Mastodon
           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')