mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 00:43:20 +01:00
Fix splitEmail() when name contains angle brackets
This commit is contained in:
parent
4a992032c9
commit
fa0cb4ff6f
@ -98,10 +98,11 @@ export function splitEmail(email_string) : { name : string, email : string }
|
||||
if(email_string && email_string.indexOf('<') !== -1)
|
||||
{
|
||||
const parts = email_string.split('<');
|
||||
if(parts[0])
|
||||
if(parts.length > 1)
|
||||
{
|
||||
split.email = parts[1].substring(0, parts[1].length - 1).trim();
|
||||
split.name = parts[0].trim();
|
||||
split.email = parts.pop();
|
||||
split.email = split.email.substring(0, split.email.length - 1).trim();
|
||||
split.name = parts.join("<").trim();
|
||||
// remove quotes
|
||||
while(split.name.length > 1 && (split.name[0] === '"' || split.name[0] === "'") && split.name[0] === split.name.substring(split.name.length - 1))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user