From 13651ea2095c0966576fd7bf44505fb5501681de Mon Sep 17 00:00:00 2001 From: Deepanshu Vangani Date: Tue, 5 Oct 2021 10:47:33 +0530 Subject: [PATCH] feat(isUrl): higher priority to whitelist (#1748) * isUrl higher priority to whitelist * remove extra line at end of package.json --- src/lib/isURL.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; }