Skip to content
Snippets Groups Projects
Commit f94300d1 authored by Thibault Delavallée's avatar Thibault Delavallée
Browse files

[FIX] mail: correctly parse formatted email in JS

Formatted emails using our own formataddr contains quotes to correctly
separate name from emails, like'"Name" <email@domain.com'. However
JS parse function does not correctly handle quotes, assuming everything
being left of opening chevron is the name.

Task-2612945 (Mail: Defensive email formatting)

X-original-commit: odoo/odoo@8694ff1e2ebcf79b0f3f9e26984df9388203b687
Part-of: odoo/odoo#134188
parent 4911dd2a
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,8 @@ function parseEmail(text) {
if (text){
var result = text.match(/(.*)<(.*@.*)>/);
if (result) {
return [_.str.trim(result[1]), _.str.trim(result[2])];
name = _.str.trim(result[1]).replace(/(^"|"$)/g, '')
return [name, _.str.trim(result[2])];
}
result = text.match(/(.*@.*)/);
if (result) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment