-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ISEMAIL and ISURL more flexible for longer TLD #834
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @vviers ! Makes sense.
There seems to be still a genuine test failure
I think I found the issue, I didn't realize docstrings were actual tests |
Weird... the "should distinguish valid and invalid emails" tests pass on my machine but not here |
I found what was wrong, I needed to update the JS @paulfitz I can't help but notice that this function is never called in the code, do you know if it is still needed ? Is this used in your enterprise codebase perhaps ? |
Just checked, we don't use it. It was introduced in 2018, and used in an invite mechanism that has since been ripped out. So it could just be removed. Thanks for spotting this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @vviers !
Context
More and more local governments around the world use custom TLD (
.amsterdam
,.melbourne
,.corsica
,.nyc
just to name a few, full list here) and theISEMAIL
function doesn't consideremail@cityof.{TLD}
as valid if it is of length > 6.Proposal
I know validating emails is very tricky and that there is no "right way" to do this, but I think allowing longer TLDs makes sense, especially since application for gTLD was made easier back in 2011 and there are now more than 1400 TLDs (out of which 466 are longer than 6 characters).
I used 24 as the upper limit as that's the current max, though in theory TLDs could be 63 bytes as per RFC 1034.
Check my numbers
Here's a quick python script that backs up my numbers