From 19b36e5813b1f19a089f28ec4817b33697b43a55 Mon Sep 17 00:00:00 2001 From: bkellam Date: Fri, 6 Sep 2024 19:12:52 -0700 Subject: [PATCH] Fix code preview link to use HEAD instead of 'main' (since the main branch might not be named main) --- src/lib/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c03a4643..2c90833d 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -63,11 +63,11 @@ export const getCodeHostFilePreviewLink = (repoName: string, filePath: string): const info = getRepoCodeHostInfo(repoName); if (info?.type === "github") { - return `${info.repoLink}/tree/main/${filePath}`; + return `${info.repoLink}/blob/HEAD/${filePath}`; } if (info?.type === "gitlab") { - return `${info.repoLink}/-/blob/main/${filePath}`; + return `${info.repoLink}/-/blob/HEAD/${filePath}`; } return undefined;