From 93c25070fae33e123dd5aa7e347e5f68bd3993e1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 3 Feb 2021 11:45:12 -0500 Subject: [PATCH] FIX: In FastImage 2.2.2 an error is raised with a `nil` path (#11954) * FIX: In FastImage 2.2.2 an error is raised with a `nil` path Sometimes Discourse.store.path_for would return `nil`, which the job handled gracefully before, but raises an error with the new version of the gem. Note the logic of this job is a bit awkward since it depends on `nil` being a string, but at least now it's no longer filling logs with errors. * Update app/jobs/onceoff/fix_invalid_gravatar_uploads.rb Co-authored-by: Bianca Nenciu Co-authored-by: Bianca Nenciu --- app/jobs/onceoff/fix_invalid_gravatar_uploads.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/onceoff/fix_invalid_gravatar_uploads.rb b/app/jobs/onceoff/fix_invalid_gravatar_uploads.rb index bbbc9426038..515b8058717 100644 --- a/app/jobs/onceoff/fix_invalid_gravatar_uploads.rb +++ b/app/jobs/onceoff/fix_invalid_gravatar_uploads.rb @@ -6,7 +6,7 @@ module Jobs Upload.where(original_filename: "gravatar.png").find_each do |upload| # note, this still feels pretty expensive for a once off # we may need to re-evaluate this - extension = FastImage.type(Discourse.store.path_for(upload)) + extension = FastImage.type(Discourse.store.path_for(upload)) rescue nil current_extension = upload.extension if extension.to_s.downcase != current_extension.to_s.downcase