Skip to content

Commit b5a0f62

Browse files
committed
Normalize email local part to NFC
1 parent b78d047 commit b5a0f62

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ CHANGELOG
2929
used. For example, `gmali.com` will become `gmail.com`.
3030
* When `hashAddress` is used, the domain part of an email address is now
3131
normalized to NFC.
32+
* When `hashAddress` is used, the local part of an email address is now
33+
normalized to NFC.
3234

3335
6.0.0 (2023-12-05)
3436
------------------

src/request/email.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ describe('Email()', () => {
226226
md5: '2b21bc76dab3c8b1622837c1d698936c',
227227
domain: 'b\u00FCcher.com',
228228
},
229+
{
230+
email: 'bu\[email protected]',
231+
md5: '53550c712b146287a2d0dd30e5ed6f4b',
232+
domain: 'example.com',
233+
},
234+
{
235+
email: 'b\[email protected]',
236+
md5: '53550c712b146287a2d0dd30e5ed6f4b',
237+
domain: 'example.com',
238+
},
229239
];
230240

231241
test.each(normalizeTests)('%p', (arg) => {

src/request/email.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export default class Email implements EmailProps {
322322
let domain = address.substring(atIndex + 1);
323323

324324
domain = this.cleanDomain(domain);
325+
localPart = localPart.normalize('NFC');
325326

326327
let separator = '+';
327328
if (Object.prototype.hasOwnProperty.call(Email.yahooDomains, domain)) {

0 commit comments

Comments
 (0)