Corrected domain recognition

Domains with hyphens were treates like RegExps.

Fixes #244.
This commit is contained in:
kkapsner 2018-09-06 08:34:08 +02:00
parent aa91a32b68
commit 360c4628ce
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@
})
.map(function(entry){
var regExp;
var domain = !!entry.match(/^[\w.]+$/);
var domain = !!entry.match(/^[A-Za-z0-9_.-]+$/);
if (domain){
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
}

View File

@ -461,7 +461,7 @@
urlContainer.on(function({newValue, oldValue}){
newValue.forEach(function(urlSetting){
var regExp;
var domain = !!urlSetting.url.match(/^[\w.]+$/);
var domain = !!urlSetting.url.match(/^[A-Za-z0-9_.-]+$/);
if (domain){
regExp = new RegExp(
"(?:^|\\.)" + urlSetting.url.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$",