Don't try and resize images that aren't resizable

This commit is contained in:
Tom Hughes 2020-05-13 11:29:49 +01:00
parent 5432cb6db5
commit 0f9e28711c

View file

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