When installing from a local repositories, the comparison done to split a full nupkg name (eg. 'Microsoft.PowerShell.PSResourceGet.1.1.0-RC1.nupkg') into both name ('Microsoft.PowerShell.PSResourceGet') and version+extension ('1.1.0-RC1.nupkg') needs to be case insensitive.
The .nupkg name typically all lowercase, whereas the version for a package may contain some uppercase characters that cause the split comparison to fail.
This PR adds .ToLower() to both the full package name and to the 'package version and extension' in order to ensure case insensitivity all round.
Note: this bug was reproducible when attempting to find or install "Microsoft.PowerShell.PSResourceGet" v1.1.0-RC1 from a local repository. Bug was caught through CI failure.
Second bug was uncovered when running tests for this PR. When Find-PSResource would return packages found in a local repository it was not returning the correct casing for the package name. This also impacted Install because the object returned from Find is then used to create file names for installation. Incorrect casing was causing failures on Linux machines.
The fix for this is to parse out the correct package name casing when retrieving metadata for a package so that the object that is either returned or passed on to Install has the correct package name.
Note: this bug was reproducible when attempting to install a package from a local repository with the incorrect casing for the name. For example, attempting to install clobberTestMOdule2 from a local repository (correct name is ClobberTestModule2-- this package can be found on the PSGallery).
If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
PR Summary
When installing from a local repositories, the comparison done to split a full nupkg name (eg. 'Microsoft.PowerShell.PSResourceGet.1.1.0-RC1.nupkg') into both name ('Microsoft.PowerShell.PSResourceGet') and version+extension ('1.1.0-RC1.nupkg') needs to be case insensitive.
The .nupkg name typically all lowercase, whereas the version for a package may contain some uppercase characters that cause the split comparison to fail.
This PR adds
.ToLower()
to both the full package name and to the 'package version and extension' in order to ensure case insensitivity all round.Note: this bug was reproducible when attempting to find or install "Microsoft.PowerShell.PSResourceGet" v1.1.0-RC1 from a local repository. Bug was caught through CI failure.
Second bug was uncovered when running tests for this PR. When
Find-PSResource
would return packages found in a local repository it was not returning the correct casing for the package name. This also impactedInstall
because the object returned fromFind
is then used to create file names for installation. Incorrect casing was causing failures on Linux machines.The fix for this is to parse out the correct package name casing when retrieving metadata for a package so that the object that is either returned or passed on to
Install
has the correct package name.Note: this bug was reproducible when attempting to install a package from a local repository with the incorrect casing for the name. For example, attempting to install
clobberTestMOdule2
from a local repository (correct name is ClobberTestModule2-- this package can be found on the PSGallery).PR Context
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.