Skip to content

Commit f6a4ab9

Browse files
Add empty searchTerm param for JFrog Artifactory calls (#1533)
1 parent 7966549 commit f6a4ab9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/code/V2ServerAPICalls.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,11 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM
810810
_cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindAllFromTypeEndPoint()");
811811
string typeEndpoint = _isPSGalleryRepo && !isSearchingModule ? "/items/psscript" : String.Empty;
812812
string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000";
813+
// JFrog/Artifactory requires an empty search term to enumerate all packages in the feed
814+
string searchTerm = _isJFrogRepo ? "&searchTerm=''" : "";
813815
var prereleaseFilter = includePrerelease ? "IsAbsoluteLatestVersion&includePrerelease=true" : "IsLatestVersion";
814816

815-
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?$filter={prereleaseFilter}{paginationParam}";
817+
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?$filter={prereleaseFilter}{searchTerm}{paginationParam}";
816818
return HttpRequestCall(requestUrlV2, out errRecord);
817819
}
818820

@@ -830,6 +832,8 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i
830832
// type: Command -> just search Modules
831833
string typeEndpoint = _isPSGalleryRepo && !isSearchingModule ? "/items/psscript" : String.Empty;
832834
string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000";
835+
// JFrog/Artifactory requires an empty search term to enumerate all packages in the feed
836+
string searchTerm = _isJFrogRepo ? "&searchTerm=''" : "";
833837
var prereleaseFilter = includePrerelease ? "includePrerelease=true&$filter=IsAbsoluteLatestVersion" : "$filter=IsLatestVersion";
834838
string typeFilterPart = isSearchingModule ? $" and substringof('PSModule', Tags) eq true" : $" and substringof('PSScript', Tags) eq true";
835839

@@ -839,7 +843,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i
839843
tagFilterPart += $" and substringof('{tag}', Tags) eq true";
840844
}
841845

842-
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?{prereleaseFilter}{typeFilterPart}{tagFilterPart}{paginationParam}";
846+
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?{prereleaseFilter}{searchTerm}{typeFilterPart}{tagFilterPart}{paginationParam}";
843847

844848
return HttpRequestCall(requestUrlV2: requestUrlV2, out errRecord);
845849
}

0 commit comments

Comments
 (0)