Skip to content

Commit c642e4d

Browse files
committed
fix: set isEmailAllowed regex to case insensitive
1 parent 973fbaf commit c642e4d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/proxy/processors/push-action/checkAuthorEmails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ const isEmailAllowed = (email: string): boolean => {
1414

1515
if (
1616
commitConfig?.author?.email?.domain?.allow &&
17-
!new RegExp(commitConfig.author.email.domain.allow, 'g').test(emailDomain)
17+
!new RegExp(commitConfig.author.email.domain.allow, 'gi').test(emailDomain)
1818
) {
1919
return false;
2020
}
2121

2222
if (
2323
commitConfig?.author?.email?.local?.block &&
24-
new RegExp(commitConfig.author.email.local.block, 'g').test(emailLocal)
24+
new RegExp(commitConfig.author.email.local.block, 'gi').test(emailLocal)
2525
) {
2626
return false;
2727
}

test/processors/checkAuthorEmails.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ describe('checkAuthorEmails', () => {
534534
const result = await exec(mockReq, mockAction);
535535

536536
const step = vi.mocked(result.addStep).mock.calls[0][0];
537-
// fails because regex is case-sensitive
538-
expect(step.error).toBe(true);
537+
expect(step.error).toBe(false);
539538
});
540539
});
541540
});

0 commit comments

Comments
 (0)