-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Valid email address should only start with alphanumeric #28174
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
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(
"[email protected]",
`<p>?<a href="mailto:[email protected]" rel="nofollow">[email protected]</a></p>`
)
The expected behavior of that issue is ~
not rendered but [email protected]
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. |
I have worked with email validation before. I have a Ruby gem that does this. I am not suggesting that we try implementing a Ruby gem. 😆 But, maybe my work there might be helpful with sorting out validation and verification (tests of the validation code) within Gitea. Feel free to rip/refactor/repurpose as much of my code as you'd like: https://rubygems.org/gems/email_validator I also have a pretty thorough set of tests: I hope it helps! |
Inactive for long time, ping ~~ |
You are right, this slipped through. I ll take a stab at it this weekend. |
# Conflicts: # modules/markup/html.go
* giteaofficial/main: Add API routes to lock and unlock issues (go-gitea#34165) Make ROOT_URL support using request Host header (go-gitea#32564) Valid email address should only start with alphanumeric (go-gitea#28174) Fix notify watch failure when the content is too long (go-gitea#34233) Add "--fullname" arg to gitea admin user create (go-gitea#34241) Fix various UI problems (go-gitea#34243) markup: improve code block readability and isolate copy button (go-gitea#34009) Don't assume the default wiki branch is master in the wiki API (go-gitea#34244) [skip ci] Updated translations via Crowdin Optimize the calling code of queryElems (go-gitea#34235) Actions Runner rest api (go-gitea#33873) Fix some trivial problems (go-gitea#34237) Swift files can be passed either as file or as form value (go-gitea#34068) # Conflicts: # templates/repo/wiki/revision.tmpl
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.