Do not let email-taglist items with none string ids being checked for validation as it'd throw errors

This commit is contained in:
Hadi Nategh 2022-07-28 11:52:59 +02:00
parent 589498d549
commit 05e53f049d
2 changed files with 4 additions and 2 deletions

View File

@ -993,7 +993,8 @@ var et2_taglist_email = /** @class */ (function (_super) {
}
// We check free entries for valid email, and render as invalid if it's not.
var valid = item.id != item.label || et2_taglist_email.EMAIL_PREG.test(item.id || '');
if (!valid && item.id) {
// don't let none string id being checked as it makes no sense, and it would throw errors
if (!valid && item.id && typeof item.id == 'string') {
// automatic quote 'Becker, Ralf <rb@stylite.de>' as '"Becker, Ralf" <rb@stylite.de>'
var matches = item.id.match(/^(.*) ?<(.*)>$/);
if (matches && et2_taglist_email.EMAIL_PREG.test('"' + matches[1].trim() + '" <' + matches[2].trim() + '>')) {

View File

@ -1198,7 +1198,8 @@ class et2_taglist_email extends et2_taglist
// We check free entries for valid email, and render as invalid if it's not.
let valid = item.id != item.label || et2_taglist_email.EMAIL_PREG.test(item.id || '');
if (!valid && item.id)
// don't let none string id being checked as it makes no sense, and it would throw errors
if (!valid && item.id && typeof item.id == 'string')
{
// automatic quote 'Becker, Ralf <rb@stylite.de>' as '"Becker, Ralf" <rb@stylite.de>'
let matches = item.id.match(/^(.*) ?<(.*)>$/);