Skip to content

Find-PSResource -Repository 'PSGallery' with NuGet version range returns no versions #1630

Open
@o-l-a-v

Description

@o-l-a-v

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(9,10)' returns nothing.

If using -Debug we can se that the API request looks like below, which to me looks fine.

  • https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az'&$orderby=NormalizedVersion desc&$inlinecount=allpages&$skip=0&$filter=IsPrerelease eq false and Id eq 'Az' and NormalizedVersion gt '9.0.0' and NormalizedVersion lt '10.0.0'

I think this is a problem with the PowerShell Gallery API. It works with NuGet v3 API shim pwsh.gallery like so:

PS> Find-PSResource -Repository 'pwsh.gallery' -Name 'Az' -Version '(9,10)'

Name Version Prerelease Repository   Description
---- ------- ---------- ----------   -----------
Az   9.7.1              pwsh.gallery
Az   9.7.0              pwsh.gallery
Az   9.6.0              pwsh.gallery
Az   9.5.0              pwsh.gallery
Az   9.4.0              pwsh.gallery
Az   9.3.0              pwsh.gallery
Az   9.2.0              pwsh.gallery
Az   9.1.1              pwsh.gallery
Az   9.1.0              pwsh.gallery
Az   9.0.1              pwsh.gallery

PS>

Expected behavior

PS> Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(9,10)'

Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
Az   9.7.1              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.7.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.6.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.5.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.4.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.3.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.2.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.1.1              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.1.0              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…
Az   9.0.1              PSGallery  Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Pow…

PS>

Actual behavior

PS> Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(9,10)'
PS>

Error details

No response

Environment data

PowerShell v7.4.1
Microsoft.PowerShell.PSResourceGet v1.0.4.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions