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()
const repo = await getRepo(params.repo, user?.isAdmin ?? false);
if (!repo) return new Response("Not found", { status: 404 });
const ref = query.ref?.trim();
const ref = query.rev?.trim();
if (!ref)
return new Response(null, {
status: 302,
@@ -307,7 +307,7 @@ export const repoRoutes = new Elysia()
},
{
query: t.Object({
ref: t.Optional(t.String()),
rev: t.Optional(t.String()),
view: t.Optional(t.String()),
path: t.Optional(t.String()),
}),
▾Msrc/views/repos/BranchSelector.tsx
@@ -30,7 +30,7 @@ export function BranchSelector({
{path && <input type="hidden" name="path" value={path} />}
<span class="branch-selector-icon">⎇</span>
<select
name="ref"
name="rev"
class="branch-select"
onchange="this.form.submit()"
>
▾Mtests/e2e.test.ts
@@ -1027,7 +1027,7 @@ describe('branch selector', () => {
const page = await adminCtx.newPage();
try {
const resp = await page.request.get(
`${BASE}/my-repo/branch-switch?view=tree&ref=dev&path=src/foo`,
`${BASE}/my-repo/branch-switch?view=tree&rev=dev&path=src/foo`,
{ maxRedirects: 0 },
).catch(r => r);
// 302 redirect to /my-repo/tree/dev/src/foo
@@ -1040,7 +1040,7 @@ describe('branch selector', () => {
const page = await adminCtx.newPage();
try {
const resp = await page.request.get(
`${BASE}/my-repo/branch-switch?view=commits&ref=dev`,
`${BASE}/my-repo/branch-switch?view=commits&rev=dev`,
{ maxRedirects: 0 },
).catch(r => r);
const loc = (resp as any).headers()?.['location'] ?? '';
@@ -1052,7 +1052,7 @@ describe('branch selector', () => {
const page = await adminCtx.newPage();
try {
const resp = await page.request.get(
`${BASE}/my-repo/branch-switch?view=blob&ref=dev&path=README.md`,
`${BASE}/my-repo/branch-switch?view=blob&rev=dev&path=README.md`,
{ maxRedirects: 0 },
).catch(r => r);
const loc = (resp as any).headers()?.['location'] ?? '';