From 5f6cc4999464c7eec8d323ecaf93b8f5703c8cd0 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Fri, 6 Dec 2024 14:23:01 -0500 Subject: [PATCH] modify filter query parameter IsLatestVersion and IsAbsoluteVersion to include eq true to resolve Artifactory issue --- src/code/V2ServerAPICalls.cs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/code/V2ServerAPICalls.cs b/src/code/V2ServerAPICalls.cs index 59b1a3ab4..8786111c8 100644 --- a/src/code/V2ServerAPICalls.cs +++ b/src/code/V2ServerAPICalls.cs @@ -355,7 +355,7 @@ public override FindResults FindName(string packageName, bool includePrerelease, filterBuilder.AddCriterion($"Id eq '{packageName}'"); } - filterBuilder.AddCriterion(includePrerelease ? "IsAbsoluteLatestVersion" : "IsLatestVersion"); + filterBuilder.AddCriterion(includePrerelease ? "IsAbsoluteLatestVersion eq true" : "IsLatestVersion eq true"); if (type != ResourceType.None) { filterBuilder.AddCriterion(GetTypeFilterForRequest(type)); } @@ -424,7 +424,7 @@ public override FindResults FindNameWithTag(string packageName, string[] tags, b filterBuilder.AddCriterion($"Id eq '{packageName}'"); } - filterBuilder.AddCriterion(includePrerelease ? "IsAbsoluteLatestVersion" : "IsLatestVersion"); + filterBuilder.AddCriterion(includePrerelease ? "IsAbsoluteLatestVersion eq true" : "IsLatestVersion eq true"); if (type != ResourceType.None) { filterBuilder.AddCriterion(GetTypeFilterForRequest(type)); } @@ -649,6 +649,10 @@ public override FindResults FindVersion(string packageName, string version, Reso if (!_isJFrogRepo) { filterBuilder.AddCriterion($"Id eq '{packageName}'"); } + else + { + + } filterBuilder.AddCriterion($"NormalizedVersion eq '{version}'"); if (type != ResourceType.None) { @@ -919,9 +923,9 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); } else { - filterBuilder.AddCriterion("IsLatestVersion"); + filterBuilder.AddCriterion("IsLatestVersion eq true"); } var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?{queryBuilder.BuildQueryString()}"; return HttpRequestCall(requestUrlV2, out errRecord); @@ -959,9 +963,9 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); } else { - filterBuilder.AddCriterion("IsLatestVersion"); + filterBuilder.AddCriterion("IsLatestVersion eq true"); } filterBuilder.AddCriterion($"substringof('PS{(isSearchingModule ? "Module" : "Script")}', Tags) eq true"); @@ -996,9 +1000,9 @@ private string FindCommandOrDscResource(string[] tags, bool includePrerelease, b if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); } else { - filterBuilder.AddCriterion("IsLatestVersion"); + filterBuilder.AddCriterion("IsLatestVersion eq true"); } @@ -1038,12 +1042,11 @@ private string FindNameGlobbing(string packageName, ResourceType type, bool incl if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); } else { - filterBuilder.AddCriterion("IsLatestVersion"); + filterBuilder.AddCriterion("IsLatestVersion eq true"); } - var names = packageName.Split(new char[] {'*'}, StringSplitOptions.RemoveEmptyEntries); if (names.Length == 0) @@ -1133,12 +1136,11 @@ private string FindNameGlobbingWithTag(string packageName, string[] tags, Resour if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); } else { - filterBuilder.AddCriterion("IsLatestVersion"); + filterBuilder.AddCriterion("IsLatestVersion eq true"); } - var names = packageName.Split(new char[] {'*'}, StringSplitOptions.RemoveEmptyEntries); if (!_isPSGalleryRepo)