mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-11 21:22:10 +00:00
[PR #997] [MERGED] Fix ArchiveFactory.Open double-wrapping causing "Cannot determine compressed stream type" on Linux #1415
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/997
Author: @Copilot
Created: 10/29/2025
Status: ✅ Merged
Merged: 10/31/2025
Merged by: @adamhathcock
Base:
master← Head:copilot/fix-ziparchive-linux-issue📝 Commits (5)
ad5c655Initial plandf59c5cPlan: Fix potential ZipArchive.IsZipFile failure on Linuxdb98e5fFix ArchiveFactory.Open to avoid double-wrapping SharpCompressStreamea77666Final verification: All tests pass, no security issuesee84d97Merge remote-tracking branch 'origin/master' into copilot/fix-ziparchive-linux-issue📊 Changes
2 files changed (+33 additions, -1 deletions)
View changed files
📝
src/SharpCompress/Archives/ArchiveFactory.cs(+1 -1)📝
tests/SharpCompress.Test/ArchiveTests.cs(+32 -0)📄 Description
ArchiveFactory.Open(stream)fails on Linux with "Cannot determine compressed stream type" when the stream is already wrapped or when buffering state needs careful management.Root Cause
ArchiveFactory.Openunconditionally creates a newSharpCompressStreamwrapper:This causes double-wrapping when the stream is already a
SharpCompressStream, leading to inconsistent buffering state that manifests differently across platforms.Changes
ArchiveFactory.cs: Use
SharpCompressStream.Createinstead of constructorTests: Added coverage for both pre-wrapped and raw FileStream scenarios
Original 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.