-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Valid email address should only start with alphanumeric #28174
base: main
Are you sure you want to change the base?
Conversation
Valid email addresses should start with alphanumeric character.
Could it start with a number? |
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.
I'm afraid it's not right. According to that issue, the correct test case should be
test(
"?a@example.com",
`<p>?<a href="mailto:a@example.com" rel="nofollow">a@example.com</a></p>`
)
The expected behavior of that issue is ~
not rendered but a@example.com
rendered.
Ok, I misunderstood the issue. I ll give it another go. Thanks |
Regular expression will attempt to match valid portion of the email which start with ~,* or ? or their combination.
Ok, so hopefully I understood the issue this time. It should handle those characters in the way you have described to me in the comment. Let me know, if I need to update anything else, and I will do it. |
According to RFC and Golang's mail.ParseAddress: Although the old regexp doesn't look good, I do not see real benefit by introducing another Sorry, maybe I misunderstood the PR, will do more tests. |
Made a small change (remove the dek5troza#1 (not ideal enough, see below) Well, I am still not sure whether we should really use this patch. Test code:
Because |
I was just going by @lng2020 comment. Technically those are valid by RFC5322 but it's arguable how usable those are, as most email service providers would not allow them with rules and filters. If more changes are needed with this, I ll be happy to help and update. |
Hey guys, do you want me to update the patch, and separate ~something as valid email, or how would you like me to proceed with this? |
I do not have strong objection for the "arguable" RFC format. But there are still nits:
|
Cool, I ll give it till Monday, if there are more opinions, and start updating on Monday with things you have listed above. |
This fixes issue #27847 where regular expression allowed email address to start with special symbols. Valid email addresses should start with alphanumeric character, and as such will be rendered as email.
Added test cases from the bug report to validate, such input will not be rendered anymore as email address.