fix(isEmail): replace all dots in gmail length validation by DasDingGehtNicht · Pull Request #1718 · validatorjs/validator.js
Conversation
The gmail domain specific validator checks the length of the username part and replaces dots as they don't count against the limit. But the replace function only replaced the first dot. Fixed by using regex with g switch.
Checklist
- PR contains only changes related; no stray files, etc.
- README updated (where applicable)
- Tests written (where applicable)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add test cases?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Nice catch!
| 'test|123@m端ller.com', | ||
| 'test123+ext@gmail.com', | ||
| 'some.name.midd.leNa.me+extension@GoogleMail.com', | ||
| 'some.name.midd.leNa.me.and.locality+extension@GoogleMail.com', |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it was passing the test before? Is the GoogleMail domain part of gmail?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max length is supposed to be 30 characters without the dots and the email alias (any string after the + character) . Even after removing only one dot the old string length was less than 30
Could you add test cases?
modified existing test case.
test case: 'some.name.midd.leNa.me.and.locality+extension@GoogleMail.com',
pre-fix: invalid (somename.midd.leNa.me.and.locality = 35 chars)
post-fix: valid (somenamemiddleNameandlocality = 29 chars)
I don't know what you mean and I'm unable to Upload files it tells me
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks! 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters