From ffbc39680d08bb9818ae8f0c8e9adc18cb138633 Mon Sep 17 00:00:00 2001 From: Tanuel <tanuel.mategi@gmail.com> Date: Thu, 11 Jul 2019 16:24:45 +0200 Subject: [PATCH] fix(host-rules): Handle invalid URLs (#4049) --- lib/util/host-rules.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/util/host-rules.ts b/lib/util/host-rules.ts index c2e1225166..e9352c2dc0 100644 --- a/lib/util/host-rules.ts +++ b/lib/util/host-rules.ts @@ -60,10 +60,12 @@ function matchesHostType(rule: HostRule, search: HostRuleSearch) { } function matchesDomainName(rule: HostRule, search: HostRuleSearch) { + const hostname = search.url && URL.parse(search.url).hostname; return ( search.url && rule.domainName && - URL.parse(search.url).hostname!.endsWith(rule.domainName) + hostname && + hostname.endsWith(rule.domainName) ); } -- GitLab