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

improve nuget v2 handling for non- nuget.org sources #9172

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Feb 29, 2024

Testing against NuGet v2 APIs revealed that some sources return results in a slightly different shape and follow different mechanisms for providing the .nupkg download URL.

This PR does primarily 2 things:

  1. When parsing the results of FindPackagesById(), don't rely on the <Id> element under <properties>; it's not always there. Instead rely on the <title> element directly on the <entry>. All tested v2 APIs provided the same value (NuGet. MyGet, Artifactory).
  2. Don't assume the .nupkg download URL because different sources build it differently. Instead query the Packages(Id=...,Version=...) endpoint and check its <content> element. All tested v2 APIs provided the same value (NuGet, MyGet, Artifactory). The only difference between them was that NuGet and Artifactory had a type attribute of application/zip and MyGet had binary/octet-stream, but the end result was the same.

Fixes #9160.

@brettfo brettfo requested a review from a team as a code owner February 29, 2024 19:58
@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Feb 29, 2024
@brettfo brettfo force-pushed the dev/brettfo/nuget-v2-auth branch from 5b97038 to 614399e Compare February 29, 2024 20:00
@bdragon bdragon merged commit e88ea5e into main Mar 1, 2024
67 checks passed
@bdragon bdragon deleted the dev/brettfo/nuget-v2-auth branch March 1, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NuGet v2 APIs not working on non-nuget.org endpoints
3 participants