diff --git a/src/utils/redirect.ts b/src/utils/redirect.ts index dbbf169fd6..905efea415 100644 --- a/src/utils/redirect.ts +++ b/src/utils/redirect.ts @@ -14,8 +14,7 @@ export const validateRedirectURL = ( ) => { try { if (!url || url.endsWith('.js')) throw new Error() - if (allowRelativePath && url.startsWith('/')) return url - const newUrl = new URL(url) // valid url + const newUrl = allowRelativePath && url.startsWith('/') ? new URL(`${window.location.origin}${url}`) : new URL(url) if ( newUrl.pathname.endsWith('.js') || !['https:', 'http:'].includes(newUrl.protocol) ||