about summary refs log tree commit diff
path: root/lib/mastodon/media_cli.rb
diff options
context:
space:
mode:
authormayaeh <mayaeh@marimo-net.org>2018-11-16 17:47:40 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-11-16 09:47:40 +0100
commit8f7e3d37726cc92ccada4b6d44a46d680e4e68b0 (patch)
tree48b79f6b63a3c0d2af8d3aa6e4f3c681c49ecfc2 /lib/mastodon/media_cli.rb
parent560acf171e877b4406374793855a7157cef632c5 (diff)
Fix "tootctl media remove" can't count the file size (#9288)
* Fixed an issue where "tootctl media remove" can not count the file size.

* Fixed the problem pointed out by codeclimate.
Diffstat (limited to 'lib/mastodon/media_cli.rb')
-rw-r--r--lib/mastodon/media_cli.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb
index 99660dd1d..6152d5a09 100644
--- a/lib/mastodon/media_cli.rb
+++ b/lib/mastodon/media_cli.rb
@@ -50,10 +50,10 @@ module Mastodon
       else
         MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).reorder(nil).find_in_batches do |media_attachments|
           media_attachments.each do |m|
+            size += m.file_file_size || 0
             Maintenance::UncacheMediaWorker.new.perform(m) unless options[:dry_run]
             options[:verbose] ? say(m.id) : say('.', :green, false)
             processed += 1
-            size      += m.file_file_size || 0
           end
         end
       end