Skip to content

Commit 46082a9

Browse files
fix
1 parent 73ef0a7 commit 46082a9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/web/src/lib/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export const getCodeHostCommitUrl = ({
343343
export const getCodeHostBrowseAtBranchUrl = ({
344344
webUrl,
345345
codeHostType,
346-
branchName,
346+
branchName: _branchName,
347347
}: {
348348
webUrl?: string | null,
349349
codeHostType: CodeHostType,
@@ -353,6 +353,8 @@ export const getCodeHostBrowseAtBranchUrl = ({
353353
return undefined;
354354
}
355355

356+
const branchName = _branchName.replace(/^refs\/(heads|tags)\//, '');
357+
356358
switch (codeHostType) {
357359
case 'github':
358360
return `${webUrl}/tree/${branchName}`;
@@ -376,7 +378,7 @@ export const getCodeHostBrowseAtBranchUrl = ({
376378
export const getCodeHostBrowseFileAtBranchUrl = ({
377379
webUrl,
378380
codeHostType,
379-
branchName,
381+
branchName: _branchName,
380382
filePath,
381383
}: {
382384
webUrl?: string | null,
@@ -388,6 +390,8 @@ export const getCodeHostBrowseFileAtBranchUrl = ({
388390
return undefined;
389391
}
390392

393+
const branchName = _branchName.replace(/^refs\/(heads|tags)\//, '');
394+
391395
switch (codeHostType) {
392396
case 'github':
393397
return `${webUrl}/blob/${branchName}/${filePath}`;

0 commit comments

Comments
 (0)