From 2092e62faa8c7563eae0b630944d99339806477a Mon Sep 17 00:00:00 2001 From: Deepanshu Vangani Date: Sat, 2 Oct 2021 23:38:39 +0530 Subject: [PATCH 1/2] isUrl higher priority to whitelist --- package.json | 2 +- src/lib/isURL.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b02fd04a2..3056b48f0 100644 --- a/package.json +++ b/package.json @@ -71,4 +71,4 @@ "node": ">= 0.10" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/src/lib/isURL.js b/src/lib/isURL.js index 254297377..7f6e0ba5f 100644 --- a/src/lib/isURL.js +++ b/src/lib/isURL.js @@ -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; } From 2293c1d8853bd9aadca9b7a443a8fb95422af660 Mon Sep 17 00:00:00 2001 From: Deepanshu Vangani Date: Sun, 3 Oct 2021 11:05:25 +0530 Subject: [PATCH 2/2] remove extra line at end of package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3056b48f0..b02fd04a2 100644 --- a/package.json +++ b/package.json @@ -71,4 +71,4 @@ "node": ">= 0.10" }, "license": "MIT" -} +} \ No newline at end of file