Browse Source

ignore incomplete rules

Former-commit-id: 1188407ef386ce23fa047c214ac014489c94790e
Gildas 5 years ago
parent
commit
137a55795e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      cli/single-file

+ 3 - 1
cli/single-file

@@ -237,7 +237,9 @@ function rewriteURL(url, rewriteRules) {
 	url = url.trim();
 	rewriteRules.forEach(rewriteRule => {
 		const parts = rewriteRule.split(/ +/);
-		url = url.replace(new RegExp(parts[0]), parts[1]).trim();
+		if (parts.length == 2) {
+			url = url.replace(new RegExp(parts[0]), parts[1]).trim();
+		}
 	});
 	return url;
 }