Skip to content

Commit 63b1e4d

Browse files
fix(isEmail) do not allow non-breaking space in user part (#2237)
Co-authored-by: jpoole <[email protected]> fixes #2218
1 parent 4f63909 commit 63b1e4d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/lib/isEmail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i;
2222
const emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
2323
const gmailUserPart = /^[a-z\d]+$/;
2424
const quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
25-
const emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
25+
const emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
2626
const quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
2727
const defaultMaxEmailLength = 254;
2828
/* eslint-enable max-len */

test/validators.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ describe('Validators', () => {
6666
'"wrong()[]",:;<>@@gmail.com',
6767
6868
69+
70+
'nbsp_test@te st.com',
71+
6972
],
7073
});
7174
});
@@ -117,6 +120,7 @@ describe('Validators', () => {
117120
'hans.m端[email protected]',
118121
119122
123+
120124
],
121125
});
122126
});

0 commit comments

Comments
 (0)