From d297e60d01c91c2367a20e0779d8a6705c996a3e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 16 Mar 2022 11:19:59 +0100 Subject: [PATCH] fix(parseURL): don't fail if hostAndPath not matching --- src/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse.ts b/src/parse.ts index c5bb710d..8f278026 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -24,7 +24,7 @@ export function parseURL (input: string = '', defaultProto?: string): ParsedURL return defaultProto ? parseURL(defaultProto + input) : parsePath(input) } - const [protocol = '', auth, hostAndPath] = (input.replace(/\\/g, '/').match(/([^:/]+:)?\/\/([^/@]+@)?(.*)/) || []).splice(1) + const [protocol = '', auth, hostAndPath = ''] = (input.replace(/\\/g, '/').match(/([^:/]+:)?\/\/([^/@]+@)?(.*)/) || []).splice(1) const [host = '', path = ''] = (hostAndPath.match(/([^/?#]*)(.*)?/) || []).splice(1) const { pathname, search, hash } = parsePath(path)