mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-08 05:27:04 +00:00
ZipArchive.IsZipFile fails on Linux: Cannot determine compressed stream type #661
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Pyroluk on GitHub (Sep 27, 2024).
Originally assigned to: @Copilot on GitHub.
Hi,
Fails on Linux for zip files created on Windows using SharpCompress with:
System.InvalidOperationException : Cannot determine compressed stream type. Supported Archive Formats: Zip, Rar, 7Zip, GZip, TarSame code runs fine on Windows though.
DotNet 8, SharpCompress 0.38.0
@adamhathcock commented on GitHub (Oct 28, 2025):
Probably need more detail here.
@Pyroluk commented on GitHub (Oct 29, 2025):
Can I send you my test zip + code which has the problem on ARM Linux? It is exceeding the size limit here of 25MB for attachments.
@adamhathcock commented on GitHub (Oct 29, 2025):
More code detail and archive type might point me in the right direction. ARM is a hint which I'll look at but in theory that should be fine. I'm using ARM MacOS
@Pyroluk commented on GitHub (Oct 29, 2025):
Found a smaller test zip:
eBayHtmlParser.zip
SharpCompress 0.40.0 fails with:
System.InvalidOperationException : Cannot determine compressed stream type. Supported Archive Formats: Zip, Rar, 7Zip, GZip, Tar
Stack Trace:
at SharpCompress.Archives.ArchiveFactory.FindFactory[T](Stream stream)
at SharpCompress.Archives.ArchiveFactory.Open(Stream stream, ReaderOptions readerOptions)
This is running on an ARM64 chip with DotNet SDK Version: 9.0.306, Debian/Raspian GNU/Linux 11, 6.1.21-v8+ #1642 SMP PREEMPT aarch64.
@Pyroluk commented on GitHub (Nov 28, 2025):
While testing the new release, it turned out the issue was simply a missing Git LFS installation in the CI test pipeline.
GitLab didn’t indicate anywhere that git pull with LFS had failed.
However, the problem in this library is still the misleading error message when the stream is actually empty:
"Cannot determine compressed stream type. Supported Archive Formats: Zip, Rar, 7Zip, GZip, Tar"
@adamhathcock
Maybe we can add a check for an empty stream and throw a more specific error message in that case?
@adamhathcock commented on GitHub (Nov 28, 2025):
It's going to be hard to detect that. I guess something can be added to detect reading zero bytes.