PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
483 stars 92 forks source link

Artifactory+v2: Feed enumeration broken due to missing `searchTerm=''` parameter #1531

Closed sean-r-williams closed 7 months ago

sean-r-williams commented 7 months ago

Prerequisites

Steps to reproduce

(Related to #1485 and #1526 - spinning off a separate issue at the request of @alerickson in https://github.com/PowerShell/PSResourceGet/issues/1485#issuecomment-1897197544)

Expected behavior

All modules (or modules+scripts) are retrieved from the feed

Actual behavior

No content is retrieved from the feed

Error details

No error message

Environment data

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.1      Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSResourceR...

Key   : PSVersion
Value : 5.1.19041.3803
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.19041.3803
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Visuals

From https://github.com/PowerShell/PSResourceGet/issues/1485#issuecomment-1821859922:

When Find-Module enumerates a v2 feed, the underlying API call(s) (as identified by using -Debug) looks like this: https://artifactory.f.q.d.n/artifactory/api/nuget/v2/psgallery-nuget-local/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=40

When Find-PSResource enumerates a v2 feed, the API call looks like this: 'https://artifactory.f.q.d.n/artifactory/api/nuget/v2/psgallery-nuget-local/Search()?$filter=IsLatestVersion&$orderby=Id desc&$inlinecount=allpages&$skip=0&$top=6000'

I see three differences in the OData parameters:

  • Pagination parameters are different (window of 6000 with PSResourceGet instead of 40 on PSGet)
  • PSResourceGet requests sorting, PSGet did not
  • No search query is provided (PSGet passes an empty search term - searchTerm='')

When I try manually performing the REST calls from PSResourceGet myself, I see that Artifactory is indeed returning a response with no results: image

Upon adding searchTerm='', I get the expected response: image