File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/onboarding/containers Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,18 @@ export const CloudLoginPage: FC = () => {
5959 fetch ( '/api/env/quartz-login-url' )
6060 . then ( async response => {
6161 const quartzUrl = await response . text ( )
62- const pathname = window . location . pathname ?? ''
62+ const redirectTo = new URLSearchParams ( window . location . search ) . get (
63+ 'redirectTo'
64+ )
65+ let pathname
66+ try {
67+ // if there is a redirectTo, parse the pathname from redirect location
68+ const redirectToUrl = new URL ( redirectTo ) . pathname
69+ pathname = redirectToUrl ?? ''
70+ } catch {
71+ // else, use current location's pathname
72+ pathname = window . location . pathname ?? ''
73+ }
6374 const redirectUrl = quartzUrl + pathname
6475 console . warn ( 'Redirect to cloud url: ' , redirectUrl )
6576 window . location . replace ( redirectUrl )
You can’t perform that action at this time.
0 commit comments