forked from cybrespace/mastodon
Add `--fix-permissions` option to `tootctl media remove-orphans` (#14383)
This commit is contained in:
parent
26227c8e60
commit
71085987e8
|
@ -47,6 +47,7 @@ module Mastodon
|
||||||
|
|
||||||
option :start_after
|
option :start_after
|
||||||
option :prefix
|
option :prefix
|
||||||
|
option :fix_permissions, type: :boolean, default: false
|
||||||
option :dry_run, 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'
|
desc 'remove-orphans', 'Scan storage and check for files that do not belong to existing media attachments'
|
||||||
long_desc <<~LONG_DESC
|
long_desc <<~LONG_DESC
|
||||||
|
@ -86,6 +87,8 @@ 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]
|
||||||
|
|
||||||
path_segments = object.key.split('/')
|
path_segments = object.key.split('/')
|
||||||
path_segments.delete('cache')
|
path_segments.delete('cache')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue