Skip to content

Commit

Permalink
fix(parseURL): don't fail if hostAndPath not matching
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 16, 2022
1 parent 67713f0 commit d297e60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.ts
Expand Up @@ -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)

Expand Down

0 comments on commit d297e60

Please sign in to comment.