From 0f9e28711cfc3fa2ba3c56608abebc4cff4c21b8 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 13 May 2020 11:29:49 +0100 Subject: [PATCH] Don't try and resize images that aren't resizable --- app/mailers/notifier.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -- 2.39.5