Skip to content

Commit

Permalink
fix: disallow # in domain (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscrivo authored Nov 3, 2024
1 parent 0af589f commit 1643323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/valid_email2/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ValidEmail2
class Address
attr_accessor :address

PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'`]/
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'#`]/
DEFAULT_RECIPIENT_DELIMITER = '+'
DOT_DELIMITER = '.'

Expand Down
5 changes: 5 additions & 0 deletions spec/valid_email2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ class TestUserMultiple < TestModel
user = TestUser.new(email: "foo@example.com ")
expect(user.valid?).to be_falsey
end

it "is invalid if domain contains #" do
user = TestUser.new(email: "foo@example.com#")
expect(user.valid?).to be_falsey
end
end

describe "with disposable validation" do
Expand Down

0 comments on commit 1643323

Please sign in to comment.