Lowercase punycode domain names

This commit is contained in:
the-djmaze 2024-03-12 19:50:11 +01:00
parent d2167dd290
commit aa7323ba43

View file

@ -62,7 +62,7 @@ const
mapDomain = (domain, callback) => {
// In email addresses, only the domain name should be punycoded.
// Leave the local part (i.e. everything up to `@`) intact.
const parts = domain.split('@');
const parts = (domain || '').split('@');
parts.push(
parts.pop()
.split(regexSeparators)
@ -389,7 +389,7 @@ const
*/
toASCII: input => mapDomain(
input,
string => regexNonASCII.test(string) ? 'xn--' + encode(string) : string
string => (regexNonASCII.test(string) ? 'xn--' + encode(string) : string).toLowerCase()
)
};
})();