don't generate errors if 'upload_id' is invalid

This commit is contained in:
Régis Hanol 2017-05-11 09:07:04 +02:00
parent 9641d2413d
commit 4b7be137cb

View File

@ -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)