Skip to content

Commit e3a87df

Browse files
committed
Normalize some .com typos
1 parent 4cf2c56 commit e3a87df

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Extraneous characters after `.com` are now removed from email domain
2121
names when `hash_address` is used. For example, `example.comfoo` will
2222
become `example.com`.
23+
* Certain `.com` typos are now normalized to `.com` when `hash_address` is
24+
used. For example, `example.cam` will become `example.com`.
2325

2426
## v2.4.0 (2024-01-12)
2527

lib/minfraud/components/email.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def clean_domain(domain)
328328

329329
domain.sub!(/(?:\.com){2,}$/, '.com')
330330
domain.sub!(/\.com[^.]+$/, '.com')
331+
domain.sub!(/(?:\.(?:com|c[a-z]{1,2}m|co[ln]|[dsvx]o[mn]|))$/, '.com')
331332

332333
if TYPO_DOMAINS.key?(domain)
333334
domain = TYPO_DOMAINS[domain]

spec/components/email_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
{ input: '[email protected]', output: '[email protected]' },
7878
{ input: '[email protected]', output: '[email protected]' },
7979
{ input: '[email protected]', output: '[email protected]' },
80+
{ input: '[email protected]', output: '[email protected]' },
8081
]
8182

8283
tests.each do |i|

0 commit comments

Comments
 (0)