Skip to content

Commit

Permalink
isUrl higher priority to whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshu2506 committed Oct 2, 2021
1 parent c899b31 commit 2092e62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -71,4 +71,4 @@
"node": ">= 0.10"
},
"license": "MIT"
}
}
6 changes: 3 additions & 3 deletions src/lib/isURL.js
Expand Up @@ -145,15 +145,15 @@ export default function isURL(url, options) {
return false;
}

if (options.host_whitelist) {
return checkHost(host, options.host_whitelist);
}
if (!isIP(host) && !isFQDN(host, options) && (!ipv6 || !isIP(ipv6, 6))) {
return false;
}

host = host || ipv6;

if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
return false;
}
if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
return false;
}
Expand Down

0 comments on commit 2092e62

Please sign in to comment.