about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorStarfall <admin@plural.cafe>2020-05-15 18:30:58 -0500
committerStarfall <admin@plural.cafe>2020-05-15 18:30:58 -0500
commit3f6370500cd8bf04fab9c9d8f3099271126a3097 (patch)
tree7215e9562c06435f9e6464fee2aa0185dd108a34 /lib
parentca3af6c5b00be851e2ced9112429cfc1baa79529 (diff)
parentb7e178d2e4102bdaa1ea41dfd8ed50093cf3f60a (diff)
Update to Mastodon 3.1.4 / Merge branch 'glitch'
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/media_cli.rb13
-rw-r--r--lib/mastodon/upgrade_cli.rb4
-rw-r--r--lib/mastodon/version.rb2
3 files changed, 13 insertions, 6 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb
index 424d65a5f..2b1653335 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
@@ -191,7 +198,7 @@ module Mastodon
       if options[:status]
         scope = MediaAttachment.where(status_id: options[:status])
       elsif options[:account]
-        username, domain = username.split('@')
+        username, domain = options[:account].split('@')
         account = Account.find_remote(username, domain)
 
         if account.nil?
@@ -210,7 +217,7 @@ module Mastodon
         next if media_attachment.remote_url.blank? || (!options[:force] && media_attachment.file_file_name.present?)
 
         unless options[:dry_run]
-          media_attachment.reset_file!
+          media_attachment.file_remote_url = media_attachment.remote_url
           media_attachment.save
         end
 
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
diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb
index ba78a3c30..fa85f8e37 100644
--- a/lib/mastodon/version.rb
+++ b/lib/mastodon/version.rb
@@ -13,7 +13,7 @@ module Mastodon
     end
 
     def patch
-      3
+      4
     end
 
     def flags