Skip to content

Commit eadca89

Browse files
committed
Stops relying on isVsts in Azure issue link generation
Stops relying on isVsts method in forming the resulting link. Instead, it transforms the repository's baseUrl properly by removing the project name from it. (#4776, #4777, #4837)
1 parent 0281dcf commit eadca89

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/git/remotes/azure-devops.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { LocalInfoFromRemoteUriResult, RemoteProviderId } from './remotePro
1414
import { RemoteProvider } from './remoteProvider';
1515

1616
const gitRegex = /\/_git\/?/i;
17+
const gitTailRegex = /\/_git(?:\/.*)?$/i;
1718
const legacyDefaultCollectionRegex = /^DefaultCollection\//i;
1819
const orgAndProjectRegex = /^(.*?)\/(.*?)\/(.*)/;
1920
const sshDomainRegex = /^(ssh|vs-ssh)\./i;
@@ -70,10 +71,9 @@ export class AzureDevOpsRemote extends RemoteProvider {
7071
}
7172

7273
protected override get issueLinkPattern(): string {
73-
if (isVsts(this.domain)) {
74-
return `${this.protocol}://${this.domain}/_workitems/edit/<num>`;
75-
}
76-
return `${this.protocol}://${this.domain}/${this.owner}/_workitems/edit/<num>`;
74+
const projectUrl = this.baseUrl.replace(gitTailRegex, '');
75+
const orgUrl = projectUrl.substring(0, projectUrl.lastIndexOf('/'));
76+
return `${orgUrl}/_workitems/edit/<num>`;
7777
}
7878

7979
private _autolinks: (AutolinkReference | DynamicAutolinkReference)[] | undefined;

0 commit comments

Comments
 (0)