fix(email): dynamic subject should be escaped, cf RFC 2047 which have its own encoding

This commit is contained in:
Colin Darie 2024-02-20 18:29:41 +01:00
parent da19ba5fe4
commit c05aaa5f35
2 changed files with 3 additions and 3 deletions

View file

@ -10,7 +10,7 @@ module MailTemplateConcern
end end
def subject_for_dossier(dossier) def subject_for_dossier(dossier)
replace_tags(subject, dossier).presence || replace_tags(self.class::DEFAULT_SUBJECT, dossier) replace_tags(subject, dossier, escape: false).presence || replace_tags(self.class::DEFAULT_SUBJECT, dossier, escape: false)
end end
def body_for_dossier(dossier) def body_for_dossier(dossier)

View file

@ -140,9 +140,9 @@ RSpec.describe NotificationMailer, type: :mailer do
subject(:mail) { described_class.send_en_instruction_notification(dossier) } subject(:mail) { described_class.send_en_instruction_notification(dossier) }
context "subject has a special character" do context "subject has a special character should not be escaped" do
let(:subject) { '--libellé démarche--' } let(:subject) { '--libellé démarche--' }
it { expect(mail.subject).to eq("Mon titre avec l'apostrophe") } it { expect(mail.subject).to eq("Mon titre avec l'apostrophe") }
end end
end end
end end