diff options
author | ThibG <thib@sitedethib.com> | 2020-05-13 23:46:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 23:46:09 +0200 |
commit | e1d282023432ff4a88cb795f3a9889704314e448 (patch) | |
tree | 89f9525142d0bf876a4fb6e0117163c0a76bb78a /lib | |
parent | c6ff4c634caf718adf7280e04909c091d15add1d (diff) | |
parent | d147dd7588502f22ac825780bb1d6e54eb3613e6 (diff) |
Merge pull request #1327 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mastodon/media_cli.rb | 9 | ||||
-rw-r--r-- | lib/mastodon/upgrade_cli.rb | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb index 424d65a5f..506544446 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/media_cli.rb @@ -144,7 +144,14 @@ module Mastodon begin 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 removed += 1 diff --git a/lib/mastodon/upgrade_cli.rb b/lib/mastodon/upgrade_cli.rb index 74d13f62d..779462a4f 100644 --- a/lib/mastodon/upgrade_cli.rb +++ b/lib/mastodon/upgrade_cli.rb @@ -121,7 +121,7 @@ module Mastodon FileUtils.mv(previous_path, upgraded_path) begin - FileUtils.rmdir(previous_path, parents: true) + FileUtils.rmdir(File.dirname(previous_path), parents: true) rescue Errno::ENOTEMPTY # OK end @@ -131,7 +131,7 @@ module Mastodon unless dry_run? begin - FileUtils.rmdir(upgraded_path, parents: true) + FileUtils.rmdir(File.dirname(upgraded_path), parents: true) rescue Errno::ENOTEMPTY # OK end |