Skip to content

Commit

Permalink
fix: use startsWith for protocol matching in parseUrl
Browse files Browse the repository at this point in the history
closes #842
  • Loading branch information
balazsorban44 committed Feb 1, 2021
1 parent 1caa9bb commit 71b3122
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/parse-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function parseUrl (url) {
if (!url) { url = `${defaultHost}${defaultPath}` }

// Default to HTTPS if no protocol explictly specified
const protocol = url.match(/^http?:\/\//) ? 'http' : 'https'
const protocol = url.startsWith("http:") ? "http" : "https"

// Normalize URLs by stripping protocol and no trailing slash
url = url.replace(/^https?:\/\//, '').replace(/\/$/, '')
Expand Down

0 comments on commit 71b3122

Please sign in to comment.