diff --git a/web/context/web-app-context.tsx b/web/context/web-app-context.tsx index 2adaf16f59..98383d6bc2 100644 --- a/web/context/web-app-context.tsx +++ b/web/context/web-app-context.tsx @@ -55,7 +55,8 @@ export const useWebAppStore = create(set => ({ const getShareCodeFromRedirectUrl = (redirectUrl: string | null): string | null => { if (!redirectUrl || redirectUrl.length === 0) return null - const url = new URL(`${window.location.origin}${decodeURIComponent(redirectUrl)}`) + // base only anchors relative-path parsing; never read back (SSR-safe) + const url = new URL(decodeURIComponent(redirectUrl), 'http://base.invalid') return url.pathname.split('/').pop() || null } const getShareCodeFromPathname = (pathname: string): string | null => {