Validate URL-REGEX Source During Build Process
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy (push) Has been cancelled

This commit is contained in:
SukkaW
2026-10-27 00:05:38 +08:00
parent 2b3f4e2895
commit 4d3fd8fed1

View File

@@ -263,11 +263,13 @@ export class FileOutput {
this.processName.add(value);
}
break;
case 'URL-REGEX': {
const [, ...rest] = splitted;
this.urlRegex.add(rest.join(','));
case 'URL-REGEX':
// Surge splits rule lines on `,`, a comma in the regex (e.g. `\d{1,3}`) truncates the pattern
if (splitted.length > 2) {
throw new TypeError(`URL-REGEX must not contain ",": ${line}`);
}
this.urlRegex.add(value);
break;
}
case 'IP-CIDR':
(arg === 'no-resolve' ? this.ipcidrNoResolve : this.ipcidr).add(value);
break;