@@ -41,6 +41,7 @@ internal class V2ServerAPICalls : ServerApiCall
41
41
public FindResponseType v2FindResponseType = FindResponseType . ResponseString ;
42
42
private bool _isADORepo ;
43
43
private bool _isJFrogRepo ;
44
+ private bool _isPSGalleryRepo ;
44
45
45
46
#endregion
46
47
@@ -60,6 +61,7 @@ public V2ServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, N
60
61
var repoURL = repository . Uri . ToString ( ) . ToLower ( ) ;
61
62
_isADORepo = repoURL . Contains ( "pkgs.dev.azure.com" ) || repoURL . Contains ( "pkgs.visualstudio.com" ) ;
62
63
_isJFrogRepo = repoURL . Contains ( "jfrog" ) ;
64
+ _isPSGalleryRepo = repoURL . Contains ( "powershellgallery.com/api/v2" ) ;
63
65
}
64
66
65
67
#endregion
@@ -806,7 +808,7 @@ private HttpContent HttpRequestCallForContent(string requestUrlV2, out ErrorReco
806
808
private string FindAllFromTypeEndPoint ( bool includePrerelease , bool isSearchingModule , int skip , out ErrorRecord errRecord )
807
809
{
808
810
_cmdletPassedIn . WriteDebug ( "In V2ServerAPICalls::FindAllFromTypeEndPoint()" ) ;
809
- string typeEndpoint = isSearchingModule ? String . Empty : "/items/psscript" ;
811
+ string typeEndpoint = _isPSGalleryRepo && ! isSearchingModule ? "/items/psscript" : String . Empty ;
810
812
string paginationParam = $ "&$orderby=Id desc&$inlinecount=allpages&$skip={ skip } &$top=6000";
811
813
var prereleaseFilter = includePrerelease ? "IsAbsoluteLatestVersion&includePrerelease=true" : "IsLatestVersion" ;
812
814
@@ -826,7 +828,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i
826
828
// type: S -> just search Scripts end point
827
829
// type: DSCResource -> just search Modules
828
830
// type: Command -> just search Modules
829
- string typeEndpoint = isSearchingModule ? String . Empty : "/items/psscript" ;
831
+ string typeEndpoint = _isPSGalleryRepo && ! isSearchingModule ? "/items/psscript" : String . Empty ;
830
832
string paginationParam = $ "&$orderby=Id desc&$inlinecount=allpages&$skip={ skip } &$top=6000";
831
833
var prereleaseFilter = includePrerelease ? "includePrerelease=true&$filter=IsAbsoluteLatestVersion" : "$filter=IsLatestVersion" ;
832
834
string typeFilterPart = isSearchingModule ? $ " and substringof('PSModule', Tags) eq true" : $ " and substringof('PSScript', Tags) eq true";
0 commit comments