Repository navigation
API - Filter by version - Specifying both minimum and maximum version returns no results #270
Description
Activity
This seems fixed now (since yesterday?), assuming you would use a range with existing versions:
❯ Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(11,13)' -Debug DEBUG: In FindPSResource::ProcessResourceNameParameterSet() DEBUG: Filtering package name(s) on wildcards DEBUG: Parsing package version DEBUG: In FindHelper::FindByResourceName() DEBUG: Parameters passed in >>> Name: 'Az'; ResourceType: 'None'; VersionRange: '(11,13)'; NuGetVersion: ''; VersionType: 'VersionRange'; Version: '(11,13)'; Prerelease: 'False'; Tag: ''; Repository: 'PSGallery'; IncludeDependencies 'False' DEBUG: Searching through repository 'PSGallery' DEBUG: In FindHelper::SearchByNames() DEBUG: Version range and package name are specified DEBUG: In V2ServerAPICalls::FindVersionGlobbing() DEBUG: In V2ServerAPICalls::FindVersionGlobbing() DEBUG: In V2ServerAPICalls::HttpRequestCall() DEBUG: Request url is '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 '11.0.0' and NormalizedVersion lt '13.0.0'' DEBUG: Found package 'Az' version '12.1.0' DEBUG: Package 'Az' returned from server DEBUG: Package 'Az' was previously discovered and returned DEBUG: Found package 'Az' version '12.0.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.6.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.5.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.4.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.3.1' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.3.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.2.0' DEBUG: Package 'Az' returned from server DEBUG: Found package 'Az' version '11.1.0' DEBUG: Package 'Az' returned from server Name Version Prerelease Repository Description ---- ------- ---------- ---------- ----------- Az 12.1.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 12.0.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.6.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.5.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.4.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.3.1 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.3.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.2.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows PowerShell.… Az 11.1.0 PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with PowerShell and Windows Powe
Reacted by Olav Rønnestad Birkelando-l-a-v commented
on Jul 13, 2024 AuthorMore actionsJulian Pawlowski (@jpawlowski) Interesting.
(11,13)as in your example seems to work.(11,12)too. Also(8,9). But not(9,10).Using PSResourceGet v1.0.5:
PS > Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(9,10)' -Debug DEBUG: In FindPSResource::ProcessResourceNameParameterSet() DEBUG: Filtering package name(s) on wildcards DEBUG: Parsing package version DEBUG: In FindHelper::FindByResourceName() DEBUG: Parameters passed in >>> Name: 'Az'; ResourceType: 'None'; VersionRange: '(9,10)'; NuGetVersion: ''; VersionType: 'VersionRange'; Version: '(9,10)'; Prerelease: 'False'; Tag: ''; Repository: 'PSGallery'; IncludeDependencies 'False' DEBUG: Searching through repository 'PSGallery' DEBUG: In FindHelper::SearchByNames() DEBUG: Version range and package name are specified DEBUG: In V2ServerAPICalls::FindVersionGlobbing() DEBUG: In V2ServerAPICalls::FindVersionGlobbing() DEBUG: In V2ServerAPICalls::HttpRequestCall() DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/FindPackagesById()?$filter=NormalizedVersion+gt+%279.0.0%27+and+NormalizedVersion+lt+%2710.0.0%27+and+IsPrerelease+eq+false+and+Id+eq+%27Az%27&$inlinecount=allpages&$skip=0&$orderby=NormalizedVersion+desc&id=%27Az%27' PS >
Screenshot from PowerShell Gallery ( https://www.powershellgallery.com/packages/Az ):
Reacted by Julian PawlowskiSeems if the NuGet range goes from a number with one digit (
9) to one with two (10), PowerShell Gallery doesn't return anything. Same with EnterprisePolicyAsCode ( https://www.powershellgallery.com/packages/EnterprisePolicyAsCode ):PS > Find-PSResource -Name 'EnterprisePolicyAsCode' -Repository 'PSGallery' -Version '[9,10)' PS > Find-PSResource -Name 'EnterprisePolicyAsCode' -Repository 'PSGallery' -Version '[8,9)' Name Version Prerelease Repository Description ---- ------- ---------- ---------- ----------- EnterprisePolicyAsCode 8.6.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.5.1 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.5.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.8 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.7 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.6 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.5 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.4 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.3 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.2 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.1 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.4.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.3.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.7 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.6 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.5 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.4 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.3 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.2 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.1 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.2.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.1.1 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.1.0 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.0.1 PSGallery Enterprise Policy as Code PowerShell Module EnterprisePolicyAsCode 8.0.0 PSGallery Enterprise Policy as Code PowerShell Module PS >
This is a somewhat critical issue. Say you want to pin major version to 9 with:
Install-PSResource -Repository 'PSGallery' -TrustRepository -Name 'any_module' -Version '[9,10)'
Not possible at the moment. Unless you do something like:
Find-PSResource -Name 'EnterprisePolicyAsCode' -Repository 'PSGallery' -Version '*' | Where-Object -Property 'Version' -Match '^9.' | Sort-Object -Property 'Version' -Descending | Select-Object -First 1
But come on.. 😋 The API should be able to handle this.
Prerequisites
Steps to reproduce
I found this bug when I discovered following related issue:
Find-PSResource -Repository 'PSGallery'with NuGet version range returns no versions PSResourceGet#1630If you with PSResourceGet do:
Find-PSResource -Repository 'PSGallery' -Name 'Az' -Version '(9,10)'This produces API request:
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'Which should return all versions of Az newer than 9.0.0 and older than 10.0.0.
Expected behavior
Should get all versions of Az newer than v9.0.0 and older than v10.0.0.
Actual behavior
No versions get returned.
Error details
No response
Environment data
Not relevant, API.Version
Not relevant, API.
Visuals
No response