mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 01:15:03 +03:00
fix(studio): redirect moved dashboard routes (#51056)
I added permanent redirects for the moved Dashboard routes that still send visitors to 404s. Project and organization identifiers carry through, while the old project billing path opens the organization picker for billing. **Note:** The bare `/dashboard/project` path redirects straight to Organizations instead of the `/dashboard/projects` hop named in GROWTH-1295, since `/projects` already redirects there. ## To test Tested on the Studio preview: - [x] Requested the eight old Dashboard paths in GROWTH-1295 while signed out. Each returned 308 with the specified destination. - [ ] Request bare `/dashboard/project` while signed out on the latest preview. Expect a single 308 to `/dashboard/organizations`. - [x] Requested a project backup path with a query string. The destination kept the project ref and query string. - [x] Requested `/dashboard/project/_`. The project picker remained reachable. ## Linear - fixes GROWTH-1295 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Added permanent redirects for legacy Studio routes covering account and project pages, backups, email templates, edge-function logs, secrets, and billing settings. * Redirects preserve incoming query parameters and URL fragments; the project selector remains unaffected. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
68d5011514
commit
e0e58f8814
2 files changed
+62
No files matched your search
@@ -51,6 +51,44 @@ describe('preserveQueryAndHash', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('matchRedirect moved Studio routes', () => {
|
||||
const ref = 'abcdefghijklmnopqrst'
|
||||
|
||||
it.each([
|
||||
[`/project/${ref}/database/backups`, `/project/${ref}/database/backups/scheduled`],
|
||||
[`/project/${ref}/auth/emails`, `/project/${ref}/auth/templates`],
|
||||
[`/project/${ref}/logs/edge-functions`, `/project/${ref}/logs/edge-functions-logs`],
|
||||
[`/project/${ref}/settings/vault`, `/project/${ref}/integrations/vault/secrets`],
|
||||
[`/project/${ref}/settings/billing`, '/org/_/billing'],
|
||||
['/account', '/account/me'],
|
||||
['/org/my-org/projects', '/org/my-org'],
|
||||
['/project', '/organizations'],
|
||||
])('redirects %s to %s', (pathname, destination) => {
|
||||
expect(matchRedirect({ pathname, search: {}, isPlatform: true })).toEqual({
|
||||
destination,
|
||||
permanent: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('preserves the incoming query and hash', () => {
|
||||
expect(
|
||||
matchRedirect({
|
||||
pathname: `/project/${ref}/database/backups`,
|
||||
search: { source: 'bookmark' },
|
||||
hash: 'scheduled',
|
||||
isPlatform: true,
|
||||
})
|
||||
).toEqual({
|
||||
destination: `/project/${ref}/database/backups/scheduled?source=bookmark#scheduled`,
|
||||
permanent: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('does not intercept the project selector', () => {
|
||||
expect(matchRedirect({ pathname: '/project/_', search: {}, isPlatform: true })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('matchRedirect query/hash preservation', () => {
|
||||
it('redirects the legacy compute and disk route while preserving query and hash', () => {
|
||||
expect(
|
||||
|
||||
@@ -41,6 +41,30 @@ export const SELF_HOSTED_REDIRECTS: StudioRedirect[] = [
|
||||
]
|
||||
|
||||
export const SHARED_REDIRECTS: StudioRedirect[] = [
|
||||
{ source: '/project', destination: '/organizations', permanent: true },
|
||||
{ source: '/account', destination: '/account/me', permanent: true },
|
||||
{ source: '/org/:slug/projects', destination: '/org/:slug', permanent: true },
|
||||
{
|
||||
source: '/project/:ref/database/backups',
|
||||
destination: '/project/:ref/database/backups/scheduled',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/project/:ref/auth/emails',
|
||||
destination: '/project/:ref/auth/templates',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/project/:ref/logs/edge-functions',
|
||||
destination: '/project/:ref/logs/edge-functions-logs',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/project/:ref/settings/vault',
|
||||
destination: '/project/:ref/integrations/vault/secrets',
|
||||
permanent: true,
|
||||
},
|
||||
{ source: '/project/:ref/settings/billing', destination: '/org/_/billing', permanent: true },
|
||||
{ source: '/project/:ref/auth', destination: '/project/:ref/auth/users', permanent: true },
|
||||
{
|
||||
source: '/project/:ref/auth/advanced',
|
||||
|
||||
Reference in new issue
Block a user