From 4b7be137cbe5961b549940b1ab5f1e244995ffd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 11 May 2017 09:07:04 +0200 Subject: [PATCH] don't generate errors if 'upload_id' is invalid --- app/jobs/regular/create_avatar_thumbnails.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/regular/create_avatar_thumbnails.rb b/app/jobs/regular/create_avatar_thumbnails.rb index 445d32b9deb..651dd2b0f2c 100644 --- a/app/jobs/regular/create_avatar_thumbnails.rb +++ b/app/jobs/regular/create_avatar_thumbnails.rb @@ -7,8 +7,8 @@ module Jobs raise Discourse::InvalidParameters.new(:upload_id) if upload_id.blank? - upload = Upload.find(upload_id) - user = User.find(args[:user_id] || upload.user_id) + return unless upload = Upload.find_by(id: upload_id) + return unless user = User.find(args[:user_id] || upload.user_id) Discourse.avatar_sizes.each do |size| OptimizedImage.create_for(upload, size, size, filename: upload.original_filename, allow_animation: SiteSetting.allow_animated_avatars)