Skip to content

Commit

Permalink
update detectRegistryDomain
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroFish91 committed Jan 20, 2023
1 parent 4cf30a4 commit 1a77e09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/imageNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@

import type { ContainerRegistryManagementClient, ContainerRegistryManagementModels } from "@azure/arm-containerregistry";
import { ISubscriptionActionContext } from "@microsoft/vscode-azext-utils";
import { acrDomain, acrDomainRegExp, dockerHubDomain, dockerHubDomainRegExp, SupportedRegistries } from "../constants";
import { acrDomain, dockerHubDomain, SupportedRegistries } from "../constants";
import { createContainerRegistryManagementClient } from "./azureClients";
import { localize } from "./localize";

export namespace imageNameUtils {
export function detectRegistryDomain(imageName: string): SupportedRegistries | undefined {
if (acrDomainRegExp.test(imageName)) {
const registryName: string = imageName.split('/')[0];
if (/\.azurecr\.io$/i.test(registryName)) {
return acrDomain;
} else if (dockerHubDomainRegExp.test(imageName)) {
} else if (registryName === dockerHubDomain) {
return dockerHubDomain;
} else {
return undefined;
Expand Down

0 comments on commit 1a77e09

Please sign in to comment.