mirror of
https://github.com/SukkaW/Surge.git
synced 2026-10-28 00:20:56 +08:00
Validate URL-REGEX Source During Build Process
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user