]> cat aescling's git repositories - mastodon.git/commitdiff
Fix "tootctl media remove" can't count the file size (#9288)
authormayaeh <mayaeh@marimo-net.org>
Fri, 16 Nov 2018 08:47:40 +0000 (17:47 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 16 Nov 2018 08:47:40 +0000 (09:47 +0100)
* Fixed an issue where "tootctl media remove" can not count the file size.

* Fixed the problem pointed out by codeclimate.

lib/mastodon/media_cli.rb

index 99660dd1d9af4867348957d602540119ed3f0b11..6152d5a0950ccaf42502d6b0ca5908abaec65290 100644 (file)
@@ -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