From 0ba63b07f64e5be686f82d785845b728c011dd88 Mon Sep 17 00:00:00 2001 From: William Bernardet Date: Mon, 15 Jul 2019 18:53:04 -0700 Subject: [PATCH] AzureDevOps returns catalog:CatalogRoot as part of the /nuget/v3/registrations2-semver2//index.json query --- NuGetResources/NuGetPackageFeed3.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NuGetResources/NuGetPackageFeed3.cs b/NuGetResources/NuGetPackageFeed3.cs index 9655306..beb68c4 100644 --- a/NuGetResources/NuGetPackageFeed3.cs +++ b/NuGetResources/NuGetPackageFeed3.cs @@ -72,12 +72,16 @@ internal IEnumerable Find(string registrationUrl, NuGetSearchContex // Package is from packageId + version // PackageRegistration is from packageId bool isRegistrationType = false; + bool isCatalogRoot = false; foreach (string t in root.Metadata.type) { if (t.Equals("PackageRegistration", StringComparison.OrdinalIgnoreCase)) { isRegistrationType = true; - break; + } + else if (t.Equals("catalog:CatalogRoot", StringComparison.OrdinalIgnoreCase)) + { + isCatalogRoot = true; } } @@ -100,7 +104,7 @@ internal IEnumerable Find(string registrationUrl, NuGetSearchContex // In addition, when DeepMetadataBypass is enabled, we MUST use the registration index to get package info // If a call to -Name -RequiredVersion is done, DeepMetadataBypass will never be enabled (for now) // If we wanted, we could enable this by checking if !isRegistrationType && context.EnableDeepMetadataBypass, then call into Find with the registration index URL - if (!context.AllVersions && packageSemanticVersions != null && !context.EnableDeepMetadataBypass) + if (!context.AllVersions && packageSemanticVersions != null && !context.EnableDeepMetadataBypass && !isCatalogRoot) { foreach (SemanticVersion packageVersion in context.PackageInfo.AllVersions) {