egulias / EmailValidator4J

Java RFC strict EmailValidator
MIT License
25 stars 8 forks source link

hyphen handling issue #2

Closed steven-xing closed 5 years ago

steven-xing commented 6 years ago

Hi, I am planing using this lib to do email validation work in our project, after, our QA complained that the following email addresss should be invalid but pass the validation.

aa@bb.-cc aa@bb.-cc- aa@bb.cc-

I read the RFC1035, seems a domain label should not start with "-" and end with "-". I did take a look into your source code, and did see some logics handle the "-", but seems above cases are not covered.

Is this an intend and have some reason that above email should be treated as valid? or just a bug?

Thanks.

egulias commented 6 years ago

Hi @steven-xing looks like a bug yes. Awesome if you are able to send the fix ;), else, I'll take care when possible.

Thanks for reporting.

steven-xing commented 6 years ago

Sure, if this is a bug, I will try to fix it and send the code to you later when I confirm it works, ;) Thanks

steven-xing commented 6 years ago

Here is my fix for this issue(DomainPart.java), I tested in our product, seem works fine, but not sure if this is the right way of fixing it, up to you for final decision. you can diff the file to see the changes.

DomainPart.zip

Regards.

egulias commented 6 years ago

Thanks @steven-xing . Do you know how to do a pull request? That would make it easier. Here the link https://help.github.com/articles/creating-a-pull-request/

AlainODea commented 5 years ago

@egulias this is fixed by my PR and can be closed.