diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 5614ddf48f..4d519bf90e 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -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