Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

fix(mail_helper): remove '<' from to headers in email service requests #2595

Merged
merged 1 commit into from Aug 23, 2018

Conversation

brizental
Copy link
Member

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

@ghost ghost assigned brizental Aug 23, 2018
@ghost ghost added the waffle:active label Aug 23, 2018
@@ -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) === '<') {
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

@vladikoff vladikoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@vladikoff vladikoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

// 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) === '<') {
Copy link
Contributor

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?

Copy link
Member Author

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.

@ghost ghost assigned vladikoff Aug 23, 2018
@vladikoff vladikoff merged commit 87f0d61 into master Aug 23, 2018
@ghost ghost removed the waffle:review label Aug 23, 2018
@vladikoff vladikoff deleted the brizental/mail-helper-fix branch August 23, 2018 20:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants