Skip to content

Commit 0f53d5f

Browse files
fix(hybrid-cloud): Normalize customer domain paths for slugs starting with new (#128275)
`normalizeUrl()` skipped every `/organizations/<slug>/` path whose slug starts with `new`, not just the `/organizations/new/` route, because the lookahead was `(?!new)`. On customer domains, links for orgs such as `new-moray` or `newco` kept the `/organizations/<slug>/` prefix. The lookahead is now `(?!new/)`, so only the literal `new/` segment is exempt. `normalizeUrl.spec.tsx` keeps `/organizations/new/` unchanged and normalizes `/organizations/new-moray/issues/` and `/organizations/newco/`. The `new-moray` case fails without the fix. The backend `customer_domain_path()` has the same pattern and is fixed separately, because frontend and backend deploy separately: #128274. Refs #109061 <!-- junior-request-attribution:start --> via @joshuarli. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A3f29e2341c39dfa3441598ed78b058a7 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/agent%3A3f29e2341c39dfa3441598ed78b058a7) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A3f29e2341c39dfa3441598ed78b058a7/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Joshua Li <14209781+joshuarli@users.noreply.github.com>
1 parent 1748359 commit 0f53d5f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎static/app/utils/url/normalizeUrl.spec.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ describe('normalizeUrl', () => {
8484
['/checkout/acme/?query=value', '/checkout/?query=value'],
8585

8686
['/organizations/new/', '/organizations/new/'],
87+
['/organizations/new-moray/issues/', '/issues/'],
88+
['/organizations/newco/', '/'],
8789
['/organizations/albertos-organizations/issues/', '/issues/'],
8890
[
8991
'/organizations/albertos-organizations/issues/?_q=all#hash',

‎static/app/utils/url/normalizeUrl.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {ConfigStore} from 'sentry/stores/configStore';
44

55
// If you change this also update the patterns in sentry.api.utils
66
const NORMALIZE_PATTERNS: Array<[pattern: RegExp, replacement: string]> = [
7-
// /organizations/slug/section, but not /organizations/new
8-
[/\/organizations\/(?!new)[^/]+\/(.*)/, '/$1'],
7+
// /organizations/slug/section, but not /organizations/new/ (slugs like new-moray still match)
8+
[/\/organizations\/(?!new\/)[^/]+\/(.*)/, '/$1'],
99
// For /settings/:orgId/ -> /settings/organization/
1010
[
1111
/\/settings\/(?!account\/|billing\/|projects\/|teams\/|stats\/|seer\/)[^/]+\/?$/,

0 commit comments

Comments
 (0)