Skip to content

Commit 2ddc19d

Browse files
sean-r-williamsalerickson
authored andcommitted
Add empty searchTerm param for JFrog Artifactory calls (#1533)
1 parent 253d3c4 commit 2ddc19d

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
@@ -805,9 +805,11 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM
805805
_cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindAllFromTypeEndPoint()");
806806
string typeEndpoint = _isPSGalleryRepo && !isSearchingModule ? "/items/psscript" : String.Empty;
807807
string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000";
808+
// JFrog/Artifactory requires an empty search term to enumerate all packages in the feed
809+
string searchTerm = _isJFrogRepo ? "&searchTerm=''" : "";
808810
var prereleaseFilter = includePrerelease ? "IsAbsoluteLatestVersion&includePrerelease=true" : "IsLatestVersion";
809811

810-
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?$filter={prereleaseFilter}{paginationParam}";
812+
var requestUrlV2 = $"{Repository.Uri}{typeEndpoint}/Search()?$filter={prereleaseFilter}{searchTerm}{paginationParam}";
811813
return HttpRequestCall(requestUrlV2, out errRecord);
812814
}
813815

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

@@ -834,7 +838,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i
834838
tagFilterPart += $" and substringof('{tag}', Tags) eq true";
835839
}
836840

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

839843
return HttpRequestCall(requestUrlV2: requestUrlV2, out errRecord);
840844
}

0 commit comments

Comments
 (0)