1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Fetch errors in URL regular expressions creation #2

Fixes #602
This commit is contained in:
kkapsner 2022-04-24 20:50:06 +02:00
parent 4443d0a117
commit cfb09075eb
2 changed files with 12 additions and 2 deletions

View File

@ -15,6 +15,7 @@
}
const settings = require("./settings");
const logging = require("./logging");
function getDomainRegExpList(domainList){
@ -33,7 +34,16 @@
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
}
else {
regExp = new RegExp(entry, "i");
try {
regExp = new RegExp(entry, "i");
}
catch (error){
logging.error("Error in regular expression", entry, error);
regExp = new RegExp(
"(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$",
"i"
);
}
}
return {
value: entry,

View File

@ -6,7 +6,7 @@ Version 1.9:
-
fixes:
-
- errors in URL regular expressions broke CB
known issues:
- if a data URL is blocked the page action button does not appear