mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-10 13:39:12 +00:00
[PR #1054] Document ZipReader DirectoryEntry behavior and add verification test #1482
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?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1054
State: closed
Merged: Yes
Investigation Summary
The issue reports that
ZipReaderignoresDirectoryEntryheaders completely. After thorough investigation:Current Behavior Analysis:
LocalEntryheaders with file data, skipsDirectoryEntryheaders from central directoryDirectoryEntryheaders from central directory and seeks to local entries for dataKey Findings:
ZipReaderandZipArchivereturn identical entriesLocalEntryheaders (where name ends with/)DirectoryEntryheaders are redundant because:LocalEntryheaders in well-formed ZIPsLocalEntryheaders immediatelyMulti-Volume ZIP Limitation:
ZipReaderreturns 0 entries because file data is in other volume filesZipArchivefor multi-volume ZIPs (requires seekable streams)Conclusion:
The current behavior is intentional and correct for streaming mode. The maintainer's comment "I think I'm intentionally skipping them" is confirmed correct.
Changes Made
DirectoryEntrycase inZipReader.GetEntries()with documentation explaining why it's intentionally skippedZipReader_Returns_Same_Entries_As_ZipArchiveverifying both APIs return identical entries for single-volume ZIPsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.