mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #987] [MERGED] Fix GZip extraction NotSupportedException for non-seekable streams #1406
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/987
Author: @Copilot
Created: 10/27/2025
Status: ✅ Merged
Merged: 10/27/2025
Merged by: @adamhathcock
Base:
master← Head:copilot/fix-gzip-extract-not-supported-exception📝 Commits (6)
cf55125Initial plan51e22ceInitial plan for fixing GZip non-seekable stream support4067b6eFix GZip extraction for non-seekable streams1a76710Add explanatory comment for EntryStartPosition initialization9ebbc71Merge branch 'master' into copilot/fix-gzip-extract-not-supported-exceptionc550600Merge branch 'master' into copilot/fix-gzip-extract-not-supported-exception📊 Changes
3 files changed (+67 additions, -3 deletions)
View changed files
📝
src/SharpCompress/Archives/GZip/GZipArchiveEntry.cs(+3 -2)📝
src/SharpCompress/Common/GZip/GZipFilePart.cs(+7 -1)📝
tests/SharpCompress.Test/GZip/GZipArchiveTests.cs(+57 -0)📄 Description
GZip decompression fails when reading from non-seekable streams (e.g.,
HttpClient.GetStreamAsync()) becauseGZipFilePartunconditionally accessesstream.Position, which throwsNotSupportedExceptionon HTTP streams.Changes
GZipFilePart.cs: Check
stream.CanSeekbefore accessingPosition. SetEntryStartPosition = 0for non-seekable streams since they read sequentially from current position.GZipArchiveEntry.cs: Check
CanSeekbefore attempting position reset inOpenEntryStream().Test coverage: Added
GZip_Archive_NonSeekableStreamtest using aNonSeekableStreamwrapper to verify the fix.Usage
Note:
GZipReadersupports non-seekable streams.GZipArchive.Open()continues to require seekable streams by design.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.