]> cat aescling's git repositories - mastodon.git/commitdiff
In remove_remote, exclude removed media attachments. (#5626)
authorNaoki Kosaka <n.k@mail.yukimochi.net>
Wed, 8 Nov 2017 14:19:22 +0000 (23:19 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 8 Nov 2017 14:19:22 +0000 (15:19 +0100)
lib/tasks/mastodon.rake

index 5614ddf48f6b07319043473c8084a28817b2e763..4d519bf90e62a0ad31b38d1b5797962468bb405b 100644 (file)
@@ -81,7 +81,7 @@ namespace :mastodon do
     task remove_remote: :environment do
       time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
 
-      MediaAttachment.where.not(remote_url: '').where('created_at < ?', time_ago).find_each do |media|
+      MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media|
         media.file.destroy
         media.save
       end