mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-08 21:21:57 +00:00
[PR #1054] [MERGED] Document ZipReader DirectoryEntry behavior and add verification test #1478
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?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/1054
Author: @Copilot
Created: 11/29/2025
Status: ✅ Merged
Merged: 11/29/2025
Merged by: @adamhathcock
Base:
master← Head:copilot/fix-zipreader-directory-entry📝 Commits (6)
0d9d82dInitial planf4dddceChanges before error encountereda887390Add multi-volume ZIP documentation to FORMATS.md7f911c5Add documentation about ZipReader directory and central directory handling840e58fUpdate tests/SharpCompress.Test/Zip/ZipReaderTests.csc5da416Apply code review feedback: improve documentation structure and add explicit DirectoryEntry case📊 Changes
3 files changed (+53 additions, -1 deletions)
View changed files
📝
FORMATS.md(+6 -1)📝
src/SharpCompress/Readers/Zip/ZipReader.cs(+8 -0)📝
tests/SharpCompress.Test/Zip/ZipReaderTests.cs(+39 -0)📄 Description
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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.