logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: ecd36c1ede5df0204d467eb7413d51afaaba5120
parent: 64f2ada5d4765cc2a04b5064c3e88eb9b00adb00
Author: Thomas Leister <thomas.leister@mailbox.org>
Date:   Thu,  1 Mar 2018 23:30:06 +0100

Fixes #6584 (#6585)


Diffstat:

Mlib/tasks/mastodon.rake6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake @@ -476,8 +476,10 @@ namespace :mastodon do time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago 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 + if media.file.exists? + media.file.destroy + media.save + end end end