PowerShell / PSResourceGet

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

ACR: version last digit 0 bug produces version mismatch #1582

Closed anamnavi closed 4 months ago

anamnavi commented 4 months ago

Prerequisites

Steps to reproduce

Publish a resource with version 1.0.0.0. Publish-PSResource will succeed, but Find-PSResource with -Version "1.0", "1.0.0", "1.0.0.0" will all fail. This is because PSResourceGet code converts the user inputted version to a Normalized Version, so "1.0" becomes "1.0.0" or "1.0.0.0" becomes "1.0.0" and ACR requires the exact tag to find the package, so anything aside from "1.0.0.0" will fail and give a Package Not Found error.

This occurs if the version has 4 digits and ends with 0, or if the version has 2 digits and ends with 0.

Expected behavior

Given that a package myPkg with version "1.0.0.0" is published, all the following should work

Find-PSResource -Name "myPkg" -Version "1.0"
Find-PSResource -Name "myPkg" -Version "1.0.0"
Find-PSResource -Name "myPkg" -Version "1.0.0.0"

Actual behavior

Given that a package myPkg with version "1.0.0.0" is published, the following do not work and package is not found:

Find-PSResource -Name "myPkg" -Version "1.0"
Find-PSResource -Name "myPkg" -Version "1.0.0"
Find-PSResource -Name "myPkg" -Version "1.0.0.0"

Error details

No response

Environment data

all platforms

Visuals

No response