From: Tom Hughes Date: Wed, 13 May 2020 10:29:49 +0000 (+0100) Subject: Don't try and resize images that aren't resizable X-Git-Tag: live~2969 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/0f9e28711cfc3fa2ba3c56608abebc4cff4c21b8 Don't try and resize images that aren't resizable --- diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 10bbb10da..cebb46939 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -192,8 +192,12 @@ class Notifier < ApplicationMailer def user_avatar_file(user) avatar = user&.avatar if avatar&.attached? - image = avatar.variant(:resize => "50x50>").processed - image.service.download(image.key) + if avatar.variable? + image = avatar.variant(:resize => "50x50>").processed + image.service.download(image.key) + else + avatar.blob.download + end else File.read(Rails.root.join("app/assets/images/avatar_small.png")) end