Skip to content

Commit

Permalink
improve isHostedAzureDevOps
Browse files Browse the repository at this point in the history
  • Loading branch information
BobSilent committed Oct 6, 2023
1 parent 1bb9d96 commit 2540120
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions extension/task/utils/resolveAzureDevOpsIdentities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ export async function resolveAzureDevOpsIdentities(organizationUrl: URL, inputs:
return result;
}


const DEV_AZURE = "dev.azure.com";
const VISUALSTUDIO = "visualstudio.com";

/**
* Returns whether the extension is run in a hosted environment (as opposed to an on-premise environment).
* In Azure DevOps terms, hosted environment is also known as "Azure DevOps Services" and on-premise environment is known as
* "Team Foundation Server" or "Azure DevOps Server".
*/
function isHostedAzureDevOps(uri: URL): boolean {
const hostname = uri.hostname.toLowerCase();
return hostname.startsWith(DEV_AZURE) || hostname.endsWith(VISUALSTUDIO);
return hostname === 'dev.azure.com' || hostname.endsWith('.visualstudio.com');
}

function decodeBase64(input: string):string {
Expand Down

0 comments on commit 2540120

Please sign in to comment.