fix(mail_helper): remove '<' from to headers in email service requests #2595
Conversation
test/mail_helper.js
Outdated
@@ -53,7 +53,15 @@ module.exports = (printLogs) => { | |||
smsLink = smsUrlMatch && smsUrlMatch[1] | |||
} | |||
|
|||
var name = emailName(mail.headers.to) | |||
var name | |||
if (mail.headers['x-email-service'] === 'fxa-email-service' && mail.headers.to.charAt(0) === '<') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brizental I think we can just do something like:
'<emailservice.wat@restmail.net>'.replace(/\<(.*?)\>/g, '$1');
on the mail.headers.to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so, that's what I did at first, but then I thought, what if we wanted the <
or >
, now I realize that's unlikely and also the way I do it doesn't prevent for this case... lol
Anyways, I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ad45ecf
to
738a89c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
test/mail_helper.js
Outdated
// Workaround because the email service wraps this header in `< >`. | ||
// See: https://github.com/mozilla/fxa-content-server/pull/6470#issuecomment-415224438 | ||
var name = emailName(mail.headers.to.replace(/\<(.*?)\>/g, '$1')) | ||
if (mail.headers['x-email-service'] === 'fxa-email-service' && mail.headers.to.charAt(0) === '<') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW, that was careless of me to live it there, sorry. It's fixed.
b911262
to
a0cc416
Compare
a0cc416
to
a17ddf0
Compare
This is kind of a hack, unfortunately. It was necessary because of the way email-service dependencies do things.
See discussion: mozilla/fxa-content-server#6470
r? @vladikoff