mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-13 05:25:00 +00:00
can only get one entry from a zip or rar #398
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 @AnakinSkyCN on GitHub (May 22, 2020).
Hi,
I've tried using MoveToNextEntry to enumerate all the entries in a zip or rar with multiple entries, but it only return one entry then ended.
did I do something wrong?
@adamhathcock commented on GitHub (May 24, 2020):
The tests have a lot of examples.
Try Disposing the entry stream. You should be putting using blocks on every stream/reader
@hungyiloo commented on GitHub (Apr 13, 2021):
I'm running into this too. It happens even with
using (var entryStream = reader.OpenEntryStream())to properly dispose it.Seems to only happen with certain zip files, but unfortunately I'm dealing with data that I can't publish so I can't provide a test case. The affected files I have are password protected. It skips files only when the entry content is accessed via methods like
OpenEntryStream()orWriteEntryTo(memStream). If the entry contents is not accessed using those methods, no entries are skipped and theMoveToNextEntry()behavior works perfectly.Since my zip files were small, I got around this issue with a really dirty and poor performing hack:
IEntryIEntry.Key. A fresh zip reader needs to be created for each entry whose contents needs to be read.