Skip to content

Commit 1643323

Browse files
authored
fix: disallow # in domain (#259)
1 parent 0af589f commit 1643323

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/valid_email2/address.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module ValidEmail2
99
class Address
1010
attr_accessor :address
1111

12-
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'`]/
12+
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'#`]/
1313
DEFAULT_RECIPIENT_DELIMITER = '+'
1414
DOT_DELIMITER = '.'
1515

spec/valid_email2_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ class TestUserMultiple < TestModel
163163
user = TestUser.new(email: "[email protected] ")
164164
expect(user.valid?).to be_falsey
165165
end
166+
167+
it "is invalid if domain contains #" do
168+
user = TestUser.new(email: "[email protected]#")
169+
expect(user.valid?).to be_falsey
170+
end
166171
end
167172

168173
describe "with disposable validation" do

0 commit comments

Comments
 (0)