Skip to content

Commit b17d33b

Browse files
committed
Remove alias parts from additional yahoo domains
1 parent dceb08f commit b17d33b

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ CHANGELOG
1313
* Fastmail alias subdomain email addresses are now normalized when
1414
`hashAddress` is used. For example, `[email protected]` will become
1515
16+
* Additional `yahoo.com` email addresses now have aliases removed from
17+
their local part when `hashAddress` is used. For example,
18+
`[email protected]` will become `[email protected]` for additional
19+
`yahoo.com` domains.
1620

1721
6.0.0 (2023-12-05)
1822
------------------

src/request/email.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ describe('Email()', () => {
168168
md5: md5('[email protected]'),
169169
domain: 'bar.example.com',
170170
},
171+
{
172+
173+
md5: md5('[email protected]'),
174+
domain: 'ymail.com',
175+
},
171176
];
172177

173178
test.each(normalizeTests)('%p', (arg) => {

src/request/email.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,62 @@ export default class Email implements EmailProps {
176176
'your-mail.com': true,
177177
};
178178

179+
private static readonly yahooDomains: { [key: string]: boolean } = {
180+
'y7mail.com': true,
181+
'yahoo.at': true,
182+
'yahoo.be': true,
183+
'yahoo.bg': true,
184+
'yahoo.ca': true,
185+
'yahoo.cl': true,
186+
'yahoo.co.id': true,
187+
'yahoo.co.il': true,
188+
'yahoo.co.in': true,
189+
'yahoo.co.kr': true,
190+
'yahoo.co.nz': true,
191+
'yahoo.co.th': true,
192+
'yahoo.co.uk': true,
193+
'yahoo.co.za': true,
194+
'yahoo.com': true,
195+
'yahoo.com.ar': true,
196+
'yahoo.com.au': true,
197+
'yahoo.com.br': true,
198+
'yahoo.com.co': true,
199+
'yahoo.com.hk': true,
200+
'yahoo.com.hr': true,
201+
'yahoo.com.mx': true,
202+
'yahoo.com.my': true,
203+
'yahoo.com.pe': true,
204+
'yahoo.com.ph': true,
205+
'yahoo.com.sg': true,
206+
'yahoo.com.tr': true,
207+
'yahoo.com.tw': true,
208+
'yahoo.com.ua': true,
209+
'yahoo.com.ve': true,
210+
'yahoo.com.vn': true,
211+
'yahoo.cz': true,
212+
'yahoo.de': true,
213+
'yahoo.dk': true,
214+
'yahoo.ee': true,
215+
'yahoo.es': true,
216+
'yahoo.fi': true,
217+
'yahoo.fr': true,
218+
'yahoo.gr': true,
219+
'yahoo.hu': true,
220+
'yahoo.ie': true,
221+
'yahoo.in': true,
222+
'yahoo.it': true,
223+
'yahoo.lt': true,
224+
'yahoo.lv': true,
225+
'yahoo.nl': true,
226+
'yahoo.no': true,
227+
'yahoo.pl': true,
228+
'yahoo.pt': true,
229+
'yahoo.ro': true,
230+
'yahoo.se': true,
231+
'yahoo.sk': true,
232+
'ymail.com': true,
233+
};
234+
179235
public constructor(email: EmailProps) {
180236
if (email.address != null && !isEmail(email.address)) {
181237
throw new ArgumentError('`email.address` is an invalid email address');
@@ -216,7 +272,11 @@ export default class Email implements EmailProps {
216272

217273
domain = this.cleanDomain(domain);
218274

219-
const separator = domain === 'yahoo.com' ? '-' : '+';
275+
let separator = '+';
276+
if (Object.prototype.hasOwnProperty.call(Email.yahooDomains, domain)) {
277+
separator = '-';
278+
}
279+
220280
const separatorIndex = localPart.indexOf(separator);
221281
if (separatorIndex > 0) {
222282
localPart = localPart.substring(0, separatorIndex);

0 commit comments

Comments
 (0)