mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
Corrected domain recognition
Domains with hyphens were treates like RegExps. Fixes #244.
This commit is contained in:
parent
aa91a32b68
commit
360c4628ce
@ -29,7 +29,7 @@
|
|||||||
})
|
})
|
||||||
.map(function(entry){
|
.map(function(entry){
|
||||||
var regExp;
|
var regExp;
|
||||||
var domain = !!entry.match(/^[\w.]+$/);
|
var domain = !!entry.match(/^[A-Za-z0-9_.-]+$/);
|
||||||
if (domain){
|
if (domain){
|
||||||
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
|
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@
|
|||||||
urlContainer.on(function({newValue, oldValue}){
|
urlContainer.on(function({newValue, oldValue}){
|
||||||
newValue.forEach(function(urlSetting){
|
newValue.forEach(function(urlSetting){
|
||||||
var regExp;
|
var regExp;
|
||||||
var domain = !!urlSetting.url.match(/^[\w.]+$/);
|
var domain = !!urlSetting.url.match(/^[A-Za-z0-9_.-]+$/);
|
||||||
if (domain){
|
if (domain){
|
||||||
regExp = new RegExp(
|
regExp = new RegExp(
|
||||||
"(?:^|\\.)" + urlSetting.url.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$",
|
"(?:^|\\.)" + urlSetting.url.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user