diff --git a/src/code/V2ServerAPICalls.cs b/src/code/V2ServerAPICalls.cs index 8786111c8..a3fe0c936 100644 --- a/src/code/V2ServerAPICalls.cs +++ b/src/code/V2ServerAPICalls.cs @@ -917,16 +917,26 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM } // JFrog/Artifactory requires an empty search term to enumerate all packages in the feed + // It also deems 'IsLatestVersion eq true' and 'IsAbsoluteLatestVersion eq true' in the filter to be a bad request, so we use 'IsLatestVersion' or 'IsAbsoluteLatestVersion' only if (_isJFrogRepo) { queryBuilder.SearchTerm = "''"; - } - if (includePrerelease) { - queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); - } else { - filterBuilder.AddCriterion("IsLatestVersion eq true"); + if (includePrerelease) { + queryBuilder.AdditionalParameters["includePrerelease"] = "true"; + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + } else { + filterBuilder.AddCriterion("IsLatestVersion eq true"); + } + } + else { + if (includePrerelease) { + queryBuilder.AdditionalParameters["includePrerelease"] = "true"; + filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + } else { + filterBuilder.AddCriterion("IsLatestVersion"); + } } + var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?{queryBuilder.BuildQueryString()}"; return HttpRequestCall(requestUrlV2, out errRecord); } @@ -956,17 +966,33 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i queryBuilder.AdditionalParameters["$orderby"] = "Id desc"; } - // JFrog/Artifactory requires an empty search term to enumerate all packages in the feed - if (_isJFrogRepo) { - queryBuilder.SearchTerm = "''"; - } - if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); } else { - filterBuilder.AddCriterion("IsLatestVersion eq true"); - } + filterBuilder.AddCriterion("IsLatestVersion"); + } + + // // JFrog/Artifactory requires an empty search term to enumerate all packages in the feed + // // It also deems 'IsLatestVersion eq true' and 'IsAbsoluteLatestVersion eq true' in the filter to be a bad request, so we use 'IsLatestVersion' or 'IsAbsoluteLatestVersion' only + // if (_isJFrogRepo) { + // queryBuilder.SearchTerm = "''"; + + // if (includePrerelease) { + // queryBuilder.AdditionalParameters["includePrerelease"] = "true"; + // filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + // } else { + // filterBuilder.AddCriterion("IsLatestVersion eq true"); + // } + // } + // else { + // if (includePrerelease) { + // queryBuilder.AdditionalParameters["includePrerelease"] = "true"; + // filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + // } else { + // filterBuilder.AddCriterion("IsLatestVersion"); + // } + // } filterBuilder.AddCriterion($"substringof('PS{(isSearchingModule ? "Module" : "Script")}', Tags) eq true"); @@ -1040,11 +1066,23 @@ private string FindNameGlobbing(string packageName, ResourceType type, bool incl queryBuilder.AdditionalParameters["$orderby"] = "Id desc"; } + // JFrog/Artifactory requires an empty search term to enumerate all packages in the feed + // It also deems 'IsLatestVersion eq true' and 'IsAbsoluteLatestVersion eq true' in the filter to be a bad request, so we use 'IsLatestVersion' or 'IsAbsoluteLatestVersion' only if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + if (_isJFrogRepo) { + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + } + else { + filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + } } else { - filterBuilder.AddCriterion("IsLatestVersion eq true"); + if (_isJFrogRepo) { + filterBuilder.AddCriterion("IsLatestVersion eq true"); + } + else { + filterBuilder.AddCriterion("IsLatestVersion"); + } } var names = packageName.Split(new char[] {'*'}, StringSplitOptions.RemoveEmptyEntries); @@ -1134,11 +1172,23 @@ private string FindNameGlobbingWithTag(string packageName, string[] tags, Resour queryBuilder.AdditionalParameters["$orderby"] = "Id desc"; } + // JFrog/Artifactory requires an empty search term to enumerate all packages in the feed + // It also deems 'IsLatestVersion eq true' and 'IsAbsoluteLatestVersion eq true' in the filter to be a bad request, so we use 'IsLatestVersion' or 'IsAbsoluteLatestVersion' only if (includePrerelease) { queryBuilder.AdditionalParameters["includePrerelease"] = "true"; - filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + if (_isJFrogRepo) { + filterBuilder.AddCriterion("IsAbsoluteLatestVersion eq true"); + } + else { + filterBuilder.AddCriterion("IsAbsoluteLatestVersion"); + } } else { - filterBuilder.AddCriterion("IsLatestVersion eq true"); + if (_isJFrogRepo) { + filterBuilder.AddCriterion("IsLatestVersion eq true"); + } + else { + filterBuilder.AddCriterion("IsLatestVersion"); + } } var names = packageName.Split(new char[] {'*'}, StringSplitOptions.RemoveEmptyEntries);