Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 0572313

Browse files
committed
fix: missing end slash test unit fails
1 parent aafc559 commit 0572313

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sources/tld-match-pattern/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export function MatchPatternToRegExp(Pattern: TLDURLPattern): RegExp {
3737
RegExpStr += '://'
3838

3939
const [Host, Path] = SplitOnce(RestWithScheme, '/')
40+
if (Path === '' && Host.endsWith('*')) {
41+
throw new Error(`Invalid match pattern (missing path indicator and asterisk mark exists at its end): ${Pattern}`)
42+
}
4043

4144
RegExpStr += Host.replaceAll(/\*/g, '[A-Za-z0-9-]+').replaceAll('.', '\\.')
4245

0 commit comments

Comments
 (0)