Skip to content
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

Remove Check for Double Hyphens #88

Merged
merged 2 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/email_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def address_literal

def host_label_pattern
"#{label_is_correct_length}" \
"#{label_contains_no_more_than_one_consecutive_hyphen}" \
"#{alnum}(?:#{alnumhy}{,61}#{alnum})?"
end

Expand Down Expand Up @@ -123,10 +122,6 @@ def domain_part_is_correct_length
'(?=.{1,255}$)'
end

def label_contains_no_more_than_one_consecutive_hyphen
'(?!.*?--.*$)'
end

def atom_char
# The `atext` spec
# We are looking at this without whitespace; no whitespace support here
Expand Down
5 changes: 3 additions & 2 deletions spec/email_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ class DefaultUserWithMessage < TestModel
'john.doe@2020.a-z.com',
'john.doe@2020.a2z.com',
'john.doe@2020.12345a6789.com',
'jonh.doe@163.com'
'jonh.doe@163.com',
'test@umläut.com', # non-ASCII
'test@xn--umlut-ira.com' # ASCII-compatibale encoding of non-ASCII
]).flatten.each do |email|
context 'when using defaults' do
it "'#{email}' should be valid" do
Expand Down Expand Up @@ -477,7 +479,6 @@ class DefaultUserWithMessage < TestModel
'host-beginning-with-dot@.example.com',
'domain-beginning-with-dash@-example.com',
'domain-ending-with-dash@example-.com',
'domain-contains-double-dash@foo--example.com',
'the-local-part-is-invalid-if-it-is-longer-than-sixty-four-characters@sld.dev',
"domain-too-long@t#{".#{'o' * 63}" * 5}.long",
"user@example.com<script>alert('hello')</script>"
Expand Down