BaGet icon indicating copy to clipboard operation
BaGet copied to clipboard

Normalize readme entry path prior to extraction

Open SergeyFilippov opened this issue 2 years ago • 6 comments

The packages with "\" character in readme node cannot be pushed to BaGet on Linux.

Similar to the issue #517 it is impossible to push a package with "\" character inside of "readme" node of nuspec file.

To Reproduce

Steps to reproduce the behavior:

  1. Using v0.4.0-preview2 version of Baget in docker (sha256:c66780acc1278f7727671e6523a5fc9236b883d430058c6b9a348a2011be8f09)
  2. Trying to push a ZetaLongPath
  3. Error occures:
BaGet.Core.PackageIndexingService[0]
      Uploaded package is invalid
System.IO.FileNotFoundException: docs\readme.md
   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.GetReadmeAsync(PackageArchiveReader package, CancellationToken cancellationToken) in /src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs:line 32
   at BaGet.Core.PackageIndexingService.IndexAsync(Stream packageStream, CancellationToken cancellationToken) in /src/BaGet.Core/Indexing/PackageIndexingService.cs:line 56

Expected behavior

It is possible to upload or download this kind of packages.

SergeyFilippov avatar Mar 23 '22 10:03 SergeyFilippov

+1 Have the same issue during Mirroring nuget.org. Looking forward to a fix.

Edit: The fix from @SergeyFilippov (#728) worked for me.

Nobody84 avatar Sep 28 '22 09:09 Nobody84

Is there any progress?

Due to this issue, the package cannot be restored

VAllens avatar Aug 31 '23 02:08 VAllens

I currently run into this issue. I found out that, for example, packages mimekit.4.2.0 and mailkit.4.2.0 run into this issues. Therefor I cannot restore my projects in a docker container for deployment anymore.

PeterHagen avatar Sep 24 '23 10:09 PeterHagen

I use BaGet as a NuGet mirror and I get the same issues when getting some packages from NuGet.
Any alternative Docker image available?

R4cOOn avatar Nov 27 '23 16:11 R4cOOn

I use BaGet as a NuGet mirror and I get the same issues when getting some packages from NuGet. Any alternative Docker image available?

There is a fork, that is fairly maintained and seems to be active with merging pull requests: BaGetter. Last commit is pretty recent and adds dotnet 8 support. There is a docker image for that repo too: Docker image tags

I haven't migrated to it yet, having a locally built image with required fixes, so can't say from experience about it's stability, but the issue with the "readme" paths is solved there.

SergeyFilippov avatar Nov 27 '23 16:11 SergeyFilippov

Thanks for your reply @SergeyFilippov !
I switched my image to theirs and it's working fine.

R4cOOn avatar Nov 28 '23 07:11 R4cOOn