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

Normalize icon entry path prior to extraction #517

Merged
merged 1 commit into from
May 25, 2020
Merged

Normalize icon entry path prior to extraction #517

merged 1 commit into from
May 25, 2020

Conversation

joelverhagen
Copy link
Contributor

@joelverhagen joelverhagen commented May 25, 2020

This package cannot be pushed to BaGet on Linux: https://www.nuget.org/packages/Microsoft.Build.NoTargets/1.0.88

This is because the .nuspec has a back slash \ for the icon path. This works just fine on nuget.org (normalization is in place) and BaGet on Windows (both slashes are acceptable). Forward slash on Linux also works fine.

This is the API that NuGetGallery uses:
https://github.com/NuGet/NuGetGallery/blob/5b7c505086fae24912f3b0d3df58ffb5a9d1e8b8/src/NuGetGallery.Core/Services/FIleNameHelper.cs#L81

The error message is:

System.IO.FileNotFoundException: images\MSBuild-NuGet-Icon.png
   at NuGet.Packaging.ZipArchiveExtensions.LookupEntry(ZipArchive zipArchive, String path)
   at NuGet.Packaging.ZipArchiveExtensions.OpenFile(ZipArchive zipArchive, String path)
   at NuGet.Packaging.PackageArchiveReader.GetStream(String path)
   at NuGet.Packaging.PackageReaderBase.GetStreamAsync(String path, CancellationToken cancellationToken)
   at BaGet.Core.PackageArchiveReaderExtensions.GetIconAsync(PackageArchiveReader package, CancellationToken cancellationToken) in /home/joel/BaGet/src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs:line 54
   at BaGet.Core.PackageIndexingService.IndexAsync(Stream packageStream, CancellationToken cancellationToken) in /home/joel/BaGet/src/BaGet.Core/Indexing/PackageIndexingService.cs:line 61

@loic-sharma
Copy link
Owner

Nice catch! I'll check for more of these bugs by indexing all of nuget.org's packages some time in the future.

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