From 510904b7a89af5a9d1745c6b109742d09f90dd24 Mon Sep 17 00:00:00 2001 From: RaphaelFakhri <153192858+RaphaelFakhri@users.noreply.github.com> Date: Sat, 24 Oct 2026 17:51:56 +0000 Subject: [PATCH] fix(platform-redirect): Keep the anchor of the next path PlatformLink encodes its target, so a link such as /configuration/options/#ignoreErrors reaches /platform-redirect as next=%2Fconfiguration%2Foptions%2F%23ignoreErrors. sanitizeNext only keeps the path, so the redirect and the platform list dropped the anchor and readers landed at the top of the page. Add sanitizeNextHash, which returns the fragment limited to id characters, and append it to the redirect and platform list URLs. --- app/platform-redirect/page.tsx | 7 +++--- app/platform-redirect/utils.spec.ts | 34 ++++++++++++++++++++++++++++- app/platform-redirect/utils.ts | 22 +++++++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/app/platform-redirect/page.tsx b/app/platform-redirect/page.tsx index c1158ad278488..fa32a468249ee 100644 --- a/app/platform-redirect/page.tsx +++ b/app/platform-redirect/page.tsx @@ -7,7 +7,7 @@ import {SmartLink} from 'sentry-docs/components/smartLink'; import {extractPlatforms, getDocsRootNode, nodeForPath} from 'sentry-docs/docTree'; import {setServerContext} from 'sentry-docs/serverContext'; -import {sanitizeNext} from './utils'; +import {sanitizeNext, sanitizeNextHash} from './utils'; export const metadata: Metadata = { robots: 'noindex', @@ -29,6 +29,7 @@ export default async function Page(props: { } const pathname = sanitizeNext(next); + const hash = sanitizeNextHash(next); const isTracingAutomatedInstrumentation = pathname.replace(/\/$/, '') === '/tracing/instrumentation/automatic-instrumentation'; const rootNode = await getDocsRootNode(); @@ -145,7 +146,7 @@ export default async function Page(props: { p => p.key === requestedPlatform?.toLowerCase() ); if (validPlatform) { - return redirect(`${validPlatform.url}${pathname}`); + return redirect(`${validPlatform.url}${pathname}${hash}`); } } @@ -167,7 +168,7 @@ export default async function Page(props: {