Skip to content

Commit 53db5ef

Browse files
fix(backend): strip /browse suffix from Bitbucket Server webUrl
Bitbucket Server's API returns a self link that includes `/browse` at the end. This caused duplicate `/browse` segments when constructing file URLs and incorrect paths for commit URLs. Fixes #876 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c402b63 commit 53db5ef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/backend/src/repoCompileUtils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,12 @@ export const compileBitbucketConfig = async (
443443
throw new Error(`No ${isServer ? 'self' : 'html'} link found for ${isServer ? 'server' : 'cloud'} repo ${repoName}`);
444444
}
445445

446-
return link.href;
446+
// @note: Bitbucket Server's self link includes `/browse` at the end.
447+
// Strip it so that we can simply append either `/browse`, `/commits`, etc. to
448+
// the base URL.
449+
const href = isServer ? link.href.replace(/\/browse\/?$/, '') : link.href;
450+
451+
return href;
447452
}
448453

449454
const repos = bitbucketRepos.map((repo) => {

0 commit comments

Comments
 (0)