fix ref param being removed by tracking protection

AuthorKonata <konata@posteo.jp>
Date
Commit673f60bc39df6edc73994420ef10450a7a19227e
Parent8de77c0
3 files changed, 6 insertions(+), 6 deletions(-)
Msrc/routes/repos.tsx
@@ -273,7 +273,7 @@ export const repoRoutes = new Elysia()
273273 const repo = await getRepo(params.repo, user?.isAdmin ?? false);
274274 if (!repo) return new Response("Not found", { status: 404 });
275275
276- const ref = query.ref?.trim();
276+ const ref = query.rev?.trim();
277277 if (!ref)
278278 return new Response(null, {
279279 status: 302,
@@ -307,7 +307,7 @@ export const repoRoutes = new Elysia()
307307 },
308308 {
309309 query: t.Object({
310- ref: t.Optional(t.String()),
310+ rev: t.Optional(t.String()),
311311 view: t.Optional(t.String()),
312312 path: t.Optional(t.String()),
313313 }),
Msrc/views/repos/BranchSelector.tsx
@@ -30,7 +30,7 @@ export function BranchSelector({
3030 {path && <input type="hidden" name="path" value={path} />}
3131 <span class="branch-selector-icon">⎇</span>
3232 <select
33- name="ref"
33+ name="rev"
3434 class="branch-select"
3535 onchange="this.form.submit()"
3636 >
Mtests/e2e.test.ts
@@ -1027,7 +1027,7 @@ describe('branch selector', () => {
10271027 const page = await adminCtx.newPage();
10281028 try {
10291029 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`,
10311031 { maxRedirects: 0 },
10321032 ).catch(r => r);
10331033 // 302 redirect to /my-repo/tree/dev/src/foo
@@ -1040,7 +1040,7 @@ describe('branch selector', () => {
10401040 const page = await adminCtx.newPage();
10411041 try {
10421042 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`,
10441044 { maxRedirects: 0 },
10451045 ).catch(r => r);
10461046 const loc = (resp as any).headers()?.['location'] ?? '';
@@ -1052,7 +1052,7 @@ describe('branch selector', () => {
10521052 const page = await adminCtx.newPage();
10531053 try {
10541054 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`,
10561056 { maxRedirects: 0 },
10571057 ).catch(r => r);
10581058 const loc = (resp as any).headers()?.['location'] ?? '';