PowerShell / PSResourceGet

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

Bugfix for local repo casing issue on Linux #1750

Open anamnavi opened 1 week ago

anamnavi commented 1 week ago

For the FindNameHelper() the regex was: test_local_mod.\d+.\d+.\d+(?:[a-zA-Z0-9-.]+|.\d)?.nupkg

The first '.' matches any character whereas our intention with the regex is to match the literal '.' so I added a backslash before the '.' to escape it. If the package being searched for is test_local_mod it was matching test_local_mod.1.0.0.nupkg and also test_local_mod2.1.0.0.nupkg where the '' character was getting matched by '.' in regex and 2.1.0.0 was getting considered as the version.

The main issue Amber had found was that for FindVersionHelper() the path for the .nupkg was being constructed and we use lowercasing so on Linux that path will not be correct. Instead, once we find a matching package (by name and version) we should use the path given from the file system that has the correct casing.

PR Summary

PR Context

PR Checklist

alerickson commented 3 days ago

Other than the digit issue, everything else looks good.