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

Nuget package versions are case insensitive #358

Merged
merged 4 commits into from
Oct 22, 2022

Conversation

michelleqyun
Copy link
Contributor

Package versions in NuGet are case insensitive, and NuGet's GET package versions API returns a list of all package versions in lowercase. OSSGadget's NuGetProjectManager should lowercase a package version before comparing it against the returned list of package versions.

Copy link
Contributor

@gfs gfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution.

I'd prefer the first check be implemented with the string compare per my inline comment.

I'm not clear on the need for the second change that constructs the URL.

The comparison of strings per the documentation is case insensitive so there's no need to modify the version itself as any nuget server should be doing a case insensitive comparison.

NuGetVersion uses case insensitive string comparisons for pre-release components. This means that 1.0.0-alpha and 1.0.0-Alpha are equal.

https://learn.microsoft.com/en-us/nuget/concepts/package-versioning

In order for me to accept and merge your contribution you will need to follow the bot's instructions to accept the CLA.

@michelleqyun
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@gfs
Copy link
Contributor

gfs commented Oct 20, 2022

@michelleqyun are you a Microsoft employee? if you associate your github account with the Microsoft organization you should be able to skip the CLA.

@michelleqyun michelleqyun marked this pull request as ready for review October 21, 2022 15:41
@michelleqyun michelleqyun requested a review from gfs October 21, 2022 15:48
Copy link
Contributor

@gfs gfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments. I had to make the changes to double check that they would work. I pushed them here: https://github.com/microsoft/OSSGadget/tree/pr/358-suggested, along with a new test for case insensitive package names, from which you can git cherry-pick.

@michelleqyun michelleqyun requested a review from gfs October 21, 2022 23:24
@gfs gfs merged commit c225aca into microsoft:main Oct 22, 2022
@michelleqyun michelleqyun deleted the michelleqyun/nugetversion branch October 23, 2022 14:26
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