loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.57k stars 639 forks source link

using StripLeadingDirectorySeparators on readmePath ... #774

Closed DimeOne closed 11 months ago

DimeOne commented 1 year ago

as already done on iconPath - this fixes issues with backslash on linux aswell.

Summary of the changes (in less than 80 chars)

Addresses https://github.com/loic-sharma/BaGet/issues/513

DimeOne commented 1 year ago

Still happening on me. Using the latest image (docker pull loicsharma/baget:0.4.0-preview2).

Stack trace:

 fail: 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

Originally posted by @aldy505 in https://github.com/loic-sharma/BaGet/issues/513#issuecomment-1535715536

I experienced the same issue with https://www.nuget.org/packages/NUnit3TestAdapter while mirroring nuget.org on a linux docker image.

I've tested this fix and was able to mirror packages that failed previously. Deleted my previous PR, as I discovered a mistake and tested, that this fix was sufficient enough.