Fix infinite loop in splitEmail() when name is '"'

This commit is contained in:
nathan 2024-01-31 09:39:29 -07:00 committed by ralf
parent b2150be8f7
commit 749ebcd9d1

View File

@ -103,7 +103,7 @@ export function splitEmail(email_string) : { name : string, email : string }
split.email = parts[1].substring(0, parts[1].length - 1).trim();
split.name = parts[0].trim();
// remove quotes
while((split.name[0] === '"' || split.name[0] === "'") && split.name[0] === split.name.substr(-1))
while(split.name.length > 1 && (split.name[0] === '"' || split.name[0] === "'") && split.name[0] === split.name.substring(split.name.length - 1))
{
split.name = split.name.substring(1, split.name.length - 1);
}