From 0a5c64d17c7ccf51bdec39b84f48a517502c77fa Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 25 Feb 2021 00:14:08 +0100 Subject: [PATCH] Rake task fixed for Shring --- lib/tasks/remove_broken_screenshots.rake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/tasks/remove_broken_screenshots.rake b/lib/tasks/remove_broken_screenshots.rake index 552c128..58fbc94 100644 --- a/lib/tasks/remove_broken_screenshots.rake +++ b/lib/tasks/remove_broken_screenshots.rake @@ -10,10 +10,9 @@ namespace :debshots do # TODO: fix for Shrine - this only works for Paperclip Screenshot.all.each do |screenshot| # Check that the file actually exists - path = screenshot.image.path(:large) - # Rails.logger.info "- #{screenshot.id} (package: #{screenshot.package.name}) (path: #{path})" + path = Rails.root.join('public' + screenshot.simage_url(:large)) unless path and (File.file? path) - Rails.logger.info "Screenshot #{screenshot.id} image file not found at path '#{path}'. Removing." + Rails.logger.info "Screenshot ##{screenshot.id}'s image file not found at path '#{path}'. Removing." screenshot.delete end end