From db524a72790f12adcd996674b24f98ea702bd850 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 26 Jan 2026 16:26:35 +0100 Subject: [PATCH 1/3] fix(preprod): Remove organization slug from legacy URL redirects Legacy preprod URLs were redirecting to paths with /organizations/{slug}/ prefix, which is unnecessary on customer domains. Update redirect logic to use clean URLs (/preprod/...) that work with the dual routing system. This fixes redirects for: - Size view: /preprod/:projectId/:artifactId/ - Install view: /preprod/:projectId/:artifactId/install/ - Compare view: /preprod/:projectId/compare/:headArtifactId/ - Compare with base: /preprod/:projectId/compare/:headArtifactId/:baseArtifactId/ --- static/app/views/preprod/redirects/legacyUrlRedirect.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx index a6dc3cfd291513..8059cc46fa28ec 100644 --- a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx +++ b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx @@ -26,14 +26,14 @@ export default function LegacyPreprodRedirect() { if (isCompare && headArtifactId) { const compareType = 'size'; if (baseArtifactId) { - newPath = `/organizations/${organization.slug}/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${projectId}`; + newPath = `/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${projectId}`; } else { - newPath = `/organizations/${organization.slug}/preprod/${compareType}/compare/${headArtifactId}/?project=${projectId}`; + newPath = `/preprod/${compareType}/compare/${headArtifactId}/?project=${projectId}`; } } else if (isInstall && artifactId) { - newPath = `/organizations/${organization.slug}/preprod/install/${artifactId}/?project=${projectId}`; + newPath = `/preprod/install/${artifactId}/?project=${projectId}`; } else if (artifactId) { - newPath = `/organizations/${organization.slug}/preprod/size/${artifactId}/?project=${projectId}`; + newPath = `/preprod/size/${artifactId}/?project=${projectId}`; } if (newPath) { From e10baca7156be6993b14290a37119fd21f2edb6c Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 26 Jan 2026 16:37:55 +0100 Subject: [PATCH 2/3] fix(preprod): Make legacy URL redirects conditional on domain type Update the legacy preprod URL redirects to be conditional based on whether the request is on a customer domain. On customer domains, use clean URLs without organization slug. On non-customer domains, preserve the organization slug for backward compatibility. This ensures redirects work correctly across both domain types: - Customer domains: /preprod/size/... (no org slug) - Non-customer domains: /organizations/{slug}/preprod/size/... (with org slug) --- .../views/preprod/redirects/legacyUrlRedirect.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx index 8059cc46fa28ec..4838e9d6de2aea 100644 --- a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx +++ b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx @@ -1,5 +1,6 @@ import {useEffect} from 'react'; +import ConfigStore from 'sentry/stores/configStore'; import {useLocation} from 'sentry/utils/useLocation'; import {useNavigate} from 'sentry/utils/useNavigate'; import useOrganization from 'sentry/utils/useOrganization'; @@ -21,19 +22,22 @@ export default function LegacyPreprodRedirect() { const isInstall = location.pathname.includes('/install/'); const isCompare = location.pathname.includes('/compare/'); + const {customerDomain} = ConfigStore.getState(); + const orgPrefix = customerDomain ? '' : `/organizations/${organization.slug}`; + let newPath = ''; if (isCompare && headArtifactId) { const compareType = 'size'; if (baseArtifactId) { - newPath = `/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${projectId}`; } else { - newPath = `/preprod/${compareType}/compare/${headArtifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/?project=${projectId}`; } } else if (isInstall && artifactId) { - newPath = `/preprod/install/${artifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/install/${artifactId}/?project=${projectId}`; } else if (artifactId) { - newPath = `/preprod/size/${artifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/size/${artifactId}/?project=${projectId}`; } if (newPath) { From 34fe6b7d128d77d50e6c27acd22253e3a67f0dd5 Mon Sep 17 00:00:00 2001 From: Hector Date: Tue, 27 Jan 2026 15:44:14 +0000 Subject: [PATCH 3/3] fix(preprod): Convert project slug to numeric ID in legacy redirects Use useProjectFromSlug hook to resolve the project slug from the URL to a numeric project ID before redirecting to the new URL structure. --- .../preprod/redirects/legacyUrlRedirect.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx index 4838e9d6de2aea..1a9811b75222ad 100644 --- a/static/app/views/preprod/redirects/legacyUrlRedirect.tsx +++ b/static/app/views/preprod/redirects/legacyUrlRedirect.tsx @@ -5,6 +5,7 @@ import {useLocation} from 'sentry/utils/useLocation'; import {useNavigate} from 'sentry/utils/useNavigate'; import useOrganization from 'sentry/utils/useOrganization'; import {useParams} from 'sentry/utils/useParams'; +import useProjectFromSlug from 'sentry/utils/useProjectFromSlug'; export default function LegacyPreprodRedirect() { const params = useParams<{ @@ -16,9 +17,15 @@ export default function LegacyPreprodRedirect() { const navigate = useNavigate(); const organization = useOrganization(); const location = useLocation(); + const project = useProjectFromSlug({organization, projectSlug: params.projectId}); useEffect(() => { - const {projectId, artifactId, headArtifactId, baseArtifactId} = params; + if (!project) { + return; + } + + const {artifactId, headArtifactId, baseArtifactId} = params; + const numericProjectId = project.id; const isInstall = location.pathname.includes('/install/'); const isCompare = location.pathname.includes('/compare/'); @@ -30,20 +37,20 @@ export default function LegacyPreprodRedirect() { if (isCompare && headArtifactId) { const compareType = 'size'; if (baseArtifactId) { - newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/${baseArtifactId}/?project=${numericProjectId}`; } else { - newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/${compareType}/compare/${headArtifactId}/?project=${numericProjectId}`; } } else if (isInstall && artifactId) { - newPath = `${orgPrefix}/preprod/install/${artifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/install/${artifactId}/?project=${numericProjectId}`; } else if (artifactId) { - newPath = `${orgPrefix}/preprod/size/${artifactId}/?project=${projectId}`; + newPath = `${orgPrefix}/preprod/size/${artifactId}/?project=${numericProjectId}`; } if (newPath) { navigate(newPath, {replace: true}); } - }, [params, navigate, organization, location]); + }, [params, navigate, organization, location, project]); return null; }