Skip to content

Commit 33fce63

Browse files
committed
Fixes owner, project and repo retreival in Azure RemoteProvider for VSTS
(#4192)
1 parent 550e069 commit 33fce63

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/git/remotes/azure-devops.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Source } from '../../constants.telemetry';
44
import type { Container } from '../../container';
55
import { HostingIntegration } from '../../plus/integrations/integration';
66
import { remoteProviderIdToIntegrationId } from '../../plus/integrations/integrationService';
7-
import { parseAzureHttpsUrl } from '../../plus/integrations/providers/azure/models';
7+
import { isVsts, parseAzureHttpsUrl } from '../../plus/integrations/providers/azure/models';
88
import type { Brand, Unbrand } from '../../system/brand';
99
import type { CreatePullRequestRemoteResource } from '../models/remoteResource';
1010
import type { Repository } from '../models/repository';
@@ -122,6 +122,20 @@ export class AzureDevOpsRemote extends RemoteProvider {
122122
return 'Azure DevOps';
123123
}
124124

125+
override get owner(): string | undefined {
126+
if (isVsts(this.domain)) {
127+
return this.domain.split('.')[0];
128+
}
129+
return super.owner;
130+
}
131+
132+
override get repoName(): string | undefined {
133+
if (isVsts(this.domain)) {
134+
return this.path;
135+
}
136+
return super.repoName;
137+
}
138+
125139
override get providerDesc():
126140
| {
127141
id: GkProviderId;

src/plus/integrations/providers/azure/models.ts

+3
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ export function getAzureOwner(url: URL): string {
332332
const isVSTS = vstsHostnameRegex.test(url.hostname);
333333
return isVSTS ? getVSTSOwner(url) : getAzureDevOpsOwner(url);
334334
}
335+
export function isVsts(domain: string): boolean {
336+
return vstsHostnameRegex.test(domain);
337+
}
335338

336339
export function getAzureRepo(pr: AzurePullRequest): string {
337340
return `${pr.repository.project.name}/_git/${pr.repository.name}`;

0 commit comments

Comments
 (0)