Skip to content

Commit

Permalink
refactor(redirect): Use "master" for default branch
Browse files Browse the repository at this point in the history
It redirects to the default branch not head hash.
  • Loading branch information
5ouma committed Jun 12, 2024
1 parent c989260 commit 8cc3541
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libs/redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getRepository } from "./env.ts";
export function redirect<R extends string>(
ctx: RouterContext<R>,
userAgent: UserAgent,
ref: string = "HEAD"
ref: string = "master"
): void {
const repository = getRepository();
const url = join(
Expand Down
2 changes: 1 addition & 1 deletion test/libs/redirect_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deno.test("Redirect Detection", <R extends string>() => {
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}`
);
});

Expand Down

0 comments on commit 8cc3541

Please sign in to comment.