Skip to content

Commit

Permalink
Updates isVSTS check
Browse files Browse the repository at this point in the history
  • Loading branch information
axosoft-ramint committed Feb 3, 2025
1 parent 912fd77 commit 2c1c34b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plus/integrations/providers/azure/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from '../../../../git/models/pullRequest';
import type { Provider } from '../../../../git/models/remoteProvider';

const vstsHostnameRegex = /\.visualstudio\.com$/;

export type AzureWorkItemStateCategory = 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';

export function isClosedAzureWorkItemStateCategory(category: AzureWorkItemStateCategory | undefined): boolean {
Expand Down Expand Up @@ -289,7 +291,7 @@ export function getAzureDevOpsOwner(url: URL): string {
return url.pathname.split('/')[1];
}
export function getAzureOwner(url: URL): string {
const isVSTS = url.hostname.endsWith('visualstudio.com');
const isVSTS = vstsHostnameRegex.test(url.hostname);
return isVSTS ? getVSTSOwner(url) : getAzureDevOpsOwner(url);
}

Expand All @@ -301,7 +303,7 @@ export function getAzurePullRequestWebUrl(pr: AzurePullRequest): string {
const url = new URL(pr.url);
const baseUrl = new URL(url.origin).toString();
const repoPath = getAzureRepo(pr);
const isVSTS = url.hostname.endsWith('visualstudio.com');
const isVSTS = vstsHostnameRegex.test(url.hostname);
if (isVSTS) {
return `${baseUrl}/${repoPath}/pullrequest/${pr.pullRequestId}`;
}
Expand Down

0 comments on commit 2c1c34b

Please sign in to comment.