Fix "tootctl media remove-orphans" crashing on “Import” files (#13685)
* Fix "tootctl media remove-orphans" crashing on “Import” files * Also remove empty directories when removing orphaned mediapull/1327/head
parent
38b69512ff
commit
34756cc4e0
|
@ -19,4 +19,6 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
inflect.acronym 'ActivityStreams'
|
inflect.acronym 'ActivityStreams'
|
||||||
inflect.acronym 'JsonLd'
|
inflect.acronym 'JsonLd'
|
||||||
inflect.acronym 'NodeInfo'
|
inflect.acronym 'NodeInfo'
|
||||||
|
|
||||||
|
inflect.singular 'data', 'data'
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,7 +144,14 @@ module Mastodon
|
||||||
begin
|
begin
|
||||||
size = File.size(path)
|
size = File.size(path)
|
||||||
|
|
||||||
File.delete(path) unless options[:dry_run]
|
unless options[:dry_run]
|
||||||
|
File.delete(path)
|
||||||
|
begin
|
||||||
|
FileUtils.rmdir(File.dirname(path), parents: true)
|
||||||
|
rescue Errno::ENOTEMPTY
|
||||||
|
# OK
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
reclaimed_bytes += size
|
reclaimed_bytes += size
|
||||||
removed += 1
|
removed += 1
|
||||||
|
|
Loading…
Reference in New Issue