-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allows email address domains to be IP addresses #1435
Conversation
References: - https://learn.microsoft.com/en-us/archive/blogs/testing123/email-address-test-cases - validatorjs/validator.js#800 This doesn't make sure the IP address is valid. It only makes sure that it's not obviously invalid.
✅ Deploy Preview for guileless-rolypoly-866f8a ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
can you benchmark perf impact of this change on plain emails? |
I think validator.js approach of making this optional generally makes more sense, especially if this makes the hot path regex slower |
Sure, added to const emailSchema = z.string().email()
...
.add("email", () => {
emailSchema.parse(`someone@example.com`)
}) Without IP support: 7,224,694 ops/sec ±0.59% (96 runs sampled) I also tried with 1000 random email addresses from https://www.randomlists.com/email-addresses?qty=1000 where each one was checked in a Without IP support: 7,459 ops/sec ±0.39% (97 runs sampled) And finally, I replaced two of the 1000 random email addresses with email addresses that use IP addresses, still using the regex with IP support: 7,663 ops/sec ±0.41% (97 runs sampled) The speed is so similar that I don't think it's worth making it optional. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Leave open |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
not stale |
Thanks for this (now very old) PR! The final word on email regexes landed here: #2157 Further discussion can happen in new issues/PRs. 👍 |
Sorry I didn't make an issue first. Figured it's a small change, so I'd just offer a solution whether it's acceptable or not.
References:
This doesn't make sure the IP address is valid. It only makes sure that it's not obviously invalid.