Push package failed in linux docker when package's icon path contains '\'
See original GitHub issueDescribe the bug
Pushing a package icon path with ‘\’ to baget linux container, will cause System.IO.FileNotFoundException.
fail: BaGet.Core.PackageIndexingService[0]
Uploaded package is invalid
System.IO.FileNotFoundException: icons\mailkit-50.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 /src/BaGet.Core/Extensions/PackageArchiveReaderExtensions.cs:line 54
at BaGet.Core.PackageIndexingService.IndexAsync(Stream packageStream, CancellationToken cancellationToken) in /src/BaGet.Core/Indexing/PackageIndexingService.cs:line 61
To Reproduce
Steps to reproduce the behavior:
- Using latest BaGet image DIGEST ‘3fcb1e9f22c7’
- Push MailKit-2.4.1 to BaGet.
- See error
Additional context
After some digging, I found something interesting.
According to PackageArchiveReader:
And Nuget.Packaging:
public override Stream GetStream(string path)
{
Stream stream = null;
path = path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
if (!string.IsNullOrEmpty(path))
{
stream = _zipArchive.OpenFile(path);
}
return stream;
}
package.NuspecReader.GetIcon()
return icon path in nuspec, it could be window-style or linux-style. When it’s windows-style, and BaGet is running in linux, path = path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
will not replace ‘\’ to ‘/’.
I’m not sure it is a BaGet bug or a Nuget.Packaging bug, any thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"ERROR: Error response from daemon: ...
The only workaround for me seems "systemctl --user restart docker-desktop" or to restart the whole machine. Ubuntu 22.04.1. Docker version 23.0.
Read more >An error, "failed to solve with frontend dockerfile.v0"
I had experienced this issue after upgrading to the latest Docker Desktop version on Mac. Solved with the comment on this issue.
Read more >How to Include Files Outside of Docker's Build Context
As the Dockerfile isn't in the root of the context directory, we provide its path using the -f option. The problem with this...
Read more >How To Install and Use Docker on Ubuntu 22.04
Step 1 — Installing Docker. The Docker installation package available in the official Ubuntu repository may not be the latest version. To ensure ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Tested OK on latest docker image.
Still happening on me. Using the latest image (
docker pull loicsharma/baget:0.4.0-preview2
).Stack trace: