Skip to content

Commit

Permalink
modify filter query parameter IsLatestVersion and IsAbsoluteVersion t…
Browse files Browse the repository at this point in the history
…o include eq true to resolve Artifactory issue
  • Loading branch information
anamnavi committed Dec 6, 2024
1 parent 3e23ecb commit 5f6cc49
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/code/V2ServerAPICalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
}


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5f6cc49

Please sign in to comment.