fix ref param being removed by tracking protection
Msrc/routes/repos.tsx
| @@ -273,7 +273,7 @@ export const repoRoutes = new Elysia() | |||
|---|---|---|---|
| 273 | 273 | const repo = await getRepo(params.repo, user?.isAdmin ?? false); | |
| 274 | 274 | if (!repo) return new Response("Not found", { status: 404 }); | |
| 275 | 275 | ||
| 276 | - | const ref = query.ref?.trim(); | |
| 276 | + | const ref = query.rev?.trim(); | |
| 277 | 277 | if (!ref) | |
| 278 | 278 | return new Response(null, { | |
| 279 | 279 | status: 302, | |
| @@ -307,7 +307,7 @@ export const repoRoutes = new Elysia() | |||
|---|---|---|---|
| 307 | 307 | }, | |
| 308 | 308 | { | |
| 309 | 309 | query: t.Object({ | |
| 310 | - | ref: t.Optional(t.String()), | |
| 310 | + | rev: t.Optional(t.String()), | |
| 311 | 311 | view: t.Optional(t.String()), | |
| 312 | 312 | path: t.Optional(t.String()), | |
| 313 | 313 | }), | |
Msrc/views/repos/BranchSelector.tsx
| @@ -30,7 +30,7 @@ export function BranchSelector({ | |||
|---|---|---|---|
| 30 | 30 | {path && <input type="hidden" name="path" value={path} />} | |
| 31 | 31 | <span class="branch-selector-icon">⎇</span> | |
| 32 | 32 | <select | |
| 33 | - | name="ref" | |
| 33 | + | name="rev" | |
| 34 | 34 | class="branch-select" | |
| 35 | 35 | onchange="this.form.submit()" | |
| 36 | 36 | > | |
Mtests/e2e.test.ts
| @@ -1027,7 +1027,7 @@ describe('branch selector', () => { | |||
|---|---|---|---|
| 1027 | 1027 | const page = await adminCtx.newPage(); | |
| 1028 | 1028 | try { | |
| 1029 | 1029 | const resp = await page.request.get( | |
| 1030 | - | `${BASE}/my-repo/branch-switch?view=tree&ref=dev&path=src/foo`, | |
| 1030 | + | `${BASE}/my-repo/branch-switch?view=tree&rev=dev&path=src/foo`, | |
| 1031 | 1031 | { maxRedirects: 0 }, | |
| 1032 | 1032 | ).catch(r => r); | |
| 1033 | 1033 | // 302 redirect to /my-repo/tree/dev/src/foo | |
| @@ -1040,7 +1040,7 @@ describe('branch selector', () => { | |||
|---|---|---|---|
| 1040 | 1040 | const page = await adminCtx.newPage(); | |
| 1041 | 1041 | try { | |
| 1042 | 1042 | const resp = await page.request.get( | |
| 1043 | - | `${BASE}/my-repo/branch-switch?view=commits&ref=dev`, | |
| 1043 | + | `${BASE}/my-repo/branch-switch?view=commits&rev=dev`, | |
| 1044 | 1044 | { maxRedirects: 0 }, | |
| 1045 | 1045 | ).catch(r => r); | |
| 1046 | 1046 | const loc = (resp as any).headers()?.['location'] ?? ''; | |
| @@ -1052,7 +1052,7 @@ describe('branch selector', () => { | |||
|---|---|---|---|
| 1052 | 1052 | const page = await adminCtx.newPage(); | |
| 1053 | 1053 | try { | |
| 1054 | 1054 | const resp = await page.request.get( | |
| 1055 | - | `${BASE}/my-repo/branch-switch?view=blob&ref=dev&path=README.md`, | |
| 1055 | + | `${BASE}/my-repo/branch-switch?view=blob&rev=dev&path=README.md`, | |
| 1056 | 1056 | { maxRedirects: 0 }, | |
| 1057 | 1057 | ).catch(r => r); | |
| 1058 | 1058 | const loc = (resp as any).headers()?.['location'] ?? ''; | |