mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-12 21:22:26 +00:00
ExtractAllEntries returns no entries when reading a ZIP from a Stream #704
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 @alnkesq on GitHub (Oct 19, 2025).
Originally assigned to: @adamhathcock on GitHub.
Appears to be a regression in 0.41.0
test.zip
Generated via
7z a test.zip wallhaven-225935.jpg. Example input file must be sufficiently large for the bug to become apparent.The following code produces 0 results in SharpCompress 0.41.0.
I bisected and the issue starts occurring here
76de7d54c7(replacingstream.Position = 0;with((IStreamStack)stream).StackSeek(0);)@adamhathcock commented on GitHub (Oct 20, 2025):
I think this is slightly misleading.
You have a zip file using the Archive interface then switch to solid extraction (which is only meant for SOLID rars and 7zip) which doesn't result in anything. This is expected behavior (though I should probably throw an error).
Use the Entries collection from the archive to get your file. Or use the ReaderFactory.Open to get entries via the IReader interface.
Combining both isn't necessary for this zip nor supported
@alnkesq commented on GitHub (Oct 20, 2025):
I see, I didn't realize
ExtractAllEntrieswasn't meant to be called on non-IsSolidarchives.Now it works as expected.
@arthurvb commented on GitHub (Oct 26, 2025):
Although the issue is closed, a small question. If I do not know in advance if my archive is a SOLID rar, 7zip or something else and I want a IReader-interface to get all entries in the archive. I should first open it with the ArchiveFactory to determine this, correct? And if it is just an ordinary zip-file, close the archive and re-open using the ReaderFactory.
Would it make sense to have one method to get an IReader-interface that works on all archives? (I know I could make it myself, but I was just wondering if it would make sense or that I am missing something).
@adamhathcock commented on GitHub (Oct 27, 2025):
It's a thing to consider something that does work for everything. I haven't thought about it in a while and SOLID/Streams from 7Zip does throw a spanner into my "purity" of the interfaces.
I'd make a new issue about this.
@alex-konstantinov commented on GitHub (Dec 5, 2025):
It does seems a bit counter-productive right now yes. We have updated SharpCompress dependency to the latest version and now we have exception thrown for some of the files. As we process our users' files when we get them - we don't know what the files are, zip, rar, 7z, how they were created etc. We just need to extract all content and that's it. ExtractAllEntries was ideal way of handling archives.
Now seems like either we better revert to previous version or spend a lot of time on writing the handling code to identify the archive type, etc. etc.
From my point of view, it would be more optimal to incapsulate that kind of checks inside.
@adamhathcock commented on GitHub (Dec 5, 2025):
I get what you mean: you'd like to be able to handle all types with just one interface.
Are you using Archive or Reader?
@alex-konstantinov commented on GitHub (Dec 8, 2025):
Currently as we've reverted to version 0.40.0 we are using IArchive instance which we get from factory to extract all entries. However we also use 'Entries' properties to enumerate entries to see if there are any nested archives if we need to extract them as well. Sometimes users place archives into archives of archives :)
@paul-ennemoser-jaha commented on GitHub (Dec 9, 2025):
Hi!
We have the following method, which now after this change throws errors - it worked perfectly fine before:
Error:
What instead of ExtractAllEntries should we use?
In the meantime we also have to downgrade to 0.41.0
Thanks :)
@adamhathcock commented on GitHub (Dec 9, 2025):
I tried to capture this here: https://github.com/adamhathcock/sharpcompress/issues/1070
All ideas (including reverting) are welcome