Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'ToLower' before name comparison and split #1738

Merged
merged 25 commits into from
Oct 29, 2024
Merged

Conversation

alerickson
Copy link
Member

@alerickson alerickson commented Oct 25, 2024

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 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).

PR Context

PR Checklist

@alerickson alerickson merged commit 94dff16 into master Oct 29, 2024
12 checks passed
@alerickson alerickson deleted the localInstallBug branch October 29, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants