From 8cc35419c6e866164894e2e44980a165305d5991 Mon Sep 17 00:00:00 2001 From: 5ouma <101255979+5ouma@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:00:51 +0900 Subject: [PATCH] refactor(redirect): Use "master" for default branch It redirects to the default branch not head hash. --- src/libs/redirect.ts | 2 +- test/libs/redirect_test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/redirect.ts b/src/libs/redirect.ts index e9f1cfc..6434055 100644 --- a/src/libs/redirect.ts +++ b/src/libs/redirect.ts @@ -7,7 +7,7 @@ import { getRepository } from "./env.ts"; export function redirect( ctx: RouterContext, userAgent: UserAgent, - ref: string = "HEAD" + ref: string = "master" ): void { const repository = getRepository(); const url = join( diff --git a/test/libs/redirect_test.ts b/test/libs/redirect_test.ts index 979abac..06d9c1e 100644 --- a/test/libs/redirect_test.ts +++ b/test/libs/redirect_test.ts @@ -13,7 +13,7 @@ Deno.test("Redirect Detection", () => { assertEquals(ctx.response.status, STATUS_CODE.PermanentRedirect); assertEquals( ctx.response.headers.get("location"), - `https://github.com/${testRepo.owner}/${testRepo.name}/blob/HEAD/${testRepo.path}` + `https://github.com/${testRepo.owner}/${testRepo.name}/blob/master/${testRepo.path}` ); });