Closed manuelmeurer closed 1 year ago
Yeah, I see what you are saying. International Domain Names (IDN), when ASCII-Compatible Encoded (ACE), are getting double dashes in them. I think that is why they are getting rejected in strict
mode.
https://github.com/K-and-R/email_validator/blob/develop/lib/email_validator.rb#L126-L128
I expected GitHub this to include the lines of code (below) just by adding in the link to them (above). It did not, so here they are:
def label_contains_no_more_than_one_consecutive_hyphen
'(?!.*?--.*$)'
end
So, this behavior is very much intentional, but may be a mistake. Let me look at the RFC again.
So, I am thinking that rejecting consecutive hyphens was my mistake. I cannot see where they are not allowed in domain names.
I do see that India's Domain Registration Service does say that:
Two hyphens together is usually not permitted and also hyphens cannot appear at both third and fourth positions.
In fact, RFC 3696 clearly indicates that double hyphens preceded by "xn" should be expected. (https://www.rfc-editor.org/rfc/rfc3696#section-5)
So, definitely a bug.
Thank you for bringing it to my attention.
@manuelmeurer Fixed in version 2.2.4
Brilliant, thanks so much for the quick fix! ❤️
When I enter an email with an IDN like "test@umläut.com" in a form in my Rails app and submit it, the backend receives the ACE representation "test@xn--umlut-ira.com", which is considered invalid by email_validator in strict mode:
Is this a bug?