From 991eac93d01db5ac1af3ce6eb6fec8a5c9e45c2e Mon Sep 17 00:00:00 2001 From: Ovgodd Date: Thu, 8 Oct 2026 10:04:02 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=F0=9F=92=84(frontend)=20redesign=2050?= =?UTF-8?q?0=20error=20standalone=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/apps/impress/src/pages/500.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/frontend/apps/impress/src/pages/500.tsx b/src/frontend/apps/impress/src/pages/500.tsx index 14cdbc3b8..be29aad18 100644 --- a/src/frontend/apps/impress/src/pages/500.tsx +++ b/src/frontend/apps/impress/src/pages/500.tsx @@ -35,11 +35,17 @@ const getSafeRefreshUrl = (target?: string): string | undefined => { if (!target) { return undefined; } + const isValidRelativePath = + target.startsWith('/') && + !target.startsWith('//') && + !target.includes('\\'); + + if (!isValidRelativePath) { + return undefined; + } if (typeof window === 'undefined') { - return target.startsWith('/') && !target.startsWith('//') - ? target - : undefined; + return target; } try { @@ -55,8 +61,10 @@ const getSafeRefreshUrl = (target?: string): string | undefined => { const Page: NextPageWithLayout = () => { const { t } = useTranslation(); - const { query } = useRouter(); - const from = Array.isArray(query.from) ? query.from[0] : query.from; + const router = useRouter(); + const from = Array.isArray(router.query.from) + ? router.query.from[0] + : router.query.from; const refreshTarget = getSafeRefreshUrl(from); const pageTitle = `${t('Error 500')} - ${t('Docs')}`; @@ -122,7 +130,7 @@ const Page: NextPageWithLayout = () => { $css={actionCss} onClick={() => refreshTarget - ? window.location.assign(refreshTarget) + ? router.replace(refreshTarget) : window.location.reload() } >