]> git.openstreetmap.org Git - rails.git/commitdiff
Don't try and resize images that aren't resizable
authorTom Hughes <tom@compton.nu>
Wed, 13 May 2020 10:29:49 +0000 (11:29 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 13 May 2020 10:30:26 +0000 (11:30 +0100)
app/mailers/notifier.rb

index 10bbb10da7ff51eb673b5621dd99bd842eaf8af2..cebb4693973c6a772e4d8db609ef7b3ff97e86e8 100644 (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