Skip to content

Commit 6c43d63

Browse files
committed
Remove periods from gmail.com local parts
1 parent 06d5827 commit 6c43d63

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
* Equivalent domain names are now normalized when `hash_address` is used.
66
For example, `googlemail.com` will become `gmail.com`.
7+
* Periods are now removed from `gmail.com` email address local parts when
8+
`hash_address` is used. For example, `[email protected]` will become
9+
710

811
## v2.4.0 (2024-01-12)
912

lib/minfraud/components/email.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def clean_email_address(address)
9696
local_part.sub!(/\A([^+]+)\+.*\z/, '\1')
9797
end
9898

99+
if domain == 'gmail.com'
100+
local_part.gsub!('.', '')
101+
end
102+
99103
"#{local_part}@#{domain}"
100104
end
101105

spec/components/email_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@
6969
{ input: '[email protected]', output: '[email protected]' },
7070
{ input: '[email protected]', output: '[email protected]' },
7171
{ input: '[email protected]', output: '[email protected]' },
72-
{ input: '[email protected]', output: 'gamil.com@gmail.com' },
72+
{ input: '[email protected]', output: 'gamilcom@gmail.com' },
7373
{ input: 'Test+alias@bücher.com', output: '[email protected]' },
7474
{ input: '[email protected]', output: '[email protected]' },
75+
{ input: '[email protected]', output: '[email protected]' },
7576
]
7677

7778
tests.each do |i|

0 commit comments

Comments
 (0)