From b571055bd29007d0e135719c31f60af55ef3f89a Mon Sep 17 00:00:00 2001 From: Karl Wilbur Date: Wed, 9 Nov 2022 14:10:27 -0500 Subject: [PATCH] Removed unneeded double-hyphen verification; fixes #87 --- lib/email_validator.rb | 5 ----- spec/email_validator_spec.rb | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/email_validator.rb b/lib/email_validator.rb index ce95046..65b75b2 100644 --- a/lib/email_validator.rb +++ b/lib/email_validator.rb @@ -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 @@ -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 diff --git a/spec/email_validator_spec.rb b/spec/email_validator_spec.rb index 164c5bd..6fc0188 100644 --- a/spec/email_validator_spec.rb +++ b/spec/email_validator_spec.rb @@ -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 @@ -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"