Skip to content

Commit b66afcc

Browse files
authored
fix: normalize URL before parsing (#3077)
1 parent da991de commit b66afcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/parse-url.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ export interface InternalUrl {
1313

1414
export default function parseUrl(url?: string): InternalUrl {
1515
const defaultUrl = new URL("http://localhost:3000/api/auth")
16+
17+
if (url && !url.startsWith("http")) {
18+
url = `https://${url}`
19+
}
20+
1621
const _url = new URL(url ?? defaultUrl)
1722
const path = (_url.pathname === "/" ? defaultUrl.pathname : _url.pathname)
1823
// Remove trailing slash

0 commit comments

Comments
 (0)