Merge pull request #3780 from betagouv/fix-missing-logo

Fix when missing logo on remote storage crash email sending
This commit is contained in:
Mathieu Magnin 2019-04-11 15:49:49 +02:00 committed by GitHub
commit 62082f585a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,9 +39,14 @@ class NotificationMailer < ApplicationMailer
create_commentaire_for_notification(dossier, subject, body)
if dossier.procedure.logo?
begin
logo_filename = dossier.procedure.logo.filename
attachments.inline[logo_filename] = dossier.procedure.logo.read
@logo_url = attachments[logo_filename].url
rescue StandardError => e
# A problem occured when reading logo, maybe the logo is missing and we should clean the procedure to remove logo reference ?
Raven.capture_exception(e)
end
end
@dossier = dossier