default to main instead of HEAD when generating file url

This commit is contained in:
msukkari 2025-09-17 12:52:11 -07:00
parent 521b316d38
commit be28d3bdc6

View file

@ -227,7 +227,8 @@ export const search = async ({ query, matches, contextLines, whole }: SearchRequ
// If there are multiple branches pointing to the same revision of this file, it doesn't
// matter which branch we use here, so use the first one.
const branch = file.Branches && file.Branches.length > 0 ? file.Branches[0] : "HEAD";
// @note: bitbucket and ado don't support using HEAD for the branch in links, so we default to main here
const branch = file.Branches && file.Branches.length > 0 ? file.Branches[0] : "main";
return getFileWebUrl(template, branch, file.FileName);
})();