@@ -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
@@ -801,7 +803,7 @@ private HttpContent HttpRequestCallForContent(string requestUrlV2, out ErrorReco
801
803
private string FindAllFromTypeEndPoint ( bool includePrerelease , bool isSearchingModule , int skip , out ErrorRecord errRecord )
802
804
{
803
805
_cmdletPassedIn . WriteDebug ( "In V2ServerAPICalls::FindAllFromTypeEndPoint()" ) ;
804
- string typeEndpoint = isSearchingModule ? String . Empty : "/items/psscript" ;
806
+ string typeEndpoint = _isPSGalleryRepo && ! isSearchingModule ? "/items/psscript" : String . Empty ;
805
807
string paginationParam = $ "&$orderby=Id desc&$inlinecount=allpages&$skip={ skip } &$top=6000";
806
808
var prereleaseFilter = includePrerelease ? "IsAbsoluteLatestVersion&includePrerelease=true" : "IsLatestVersion" ;
807
809
@@ -821,7 +823,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i
821
823
// type: S -> just search Scripts end point
822
824
// type: DSCResource -> just search Modules
823
825
// type: Command -> just search Modules
824
- string typeEndpoint = isSearchingModule ? String . Empty : "/items/psscript" ;
826
+ string typeEndpoint = _isPSGalleryRepo && ! isSearchingModule ? "/items/psscript" : String . Empty ;
825
827
string paginationParam = $ "&$orderby=Id desc&$inlinecount=allpages&$skip={ skip } &$top=6000";
826
828
var prereleaseFilter = includePrerelease ? "includePrerelease=true&$filter=IsAbsoluteLatestVersion" : "$filter=IsLatestVersion" ;
827
829
string typeFilterPart = isSearchingModule ? $ " and substringof('PSModule', Tags) eq true" : $ " and substringof('PSScript', Tags) eq true";
0 commit comments