From 749ebcd9d18b16c9935b5622c2274ba6a2add50d Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 31 Jan 2024 09:39:29 -0700 Subject: [PATCH] Fix infinite loop in splitEmail() when name is '"' --- api/js/etemplate/Et2Email/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Email/utils.ts b/api/js/etemplate/Et2Email/utils.ts index effaf22f01..9f241009bd 100644 --- a/api/js/etemplate/Et2Email/utils.ts +++ b/api/js/etemplate/Et2Email/utils.ts @@ -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); }