mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #417] Allow Flush on EntryStream #1022
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/417
State: closed
Merged: Yes
I have a
tar-file that contains anothertar.gz-file that I want do extract using SharpCompress.When I am iterating through the outer
tar-file, and find thetar.gz-file I want to extract, I use a CryptoStream that calculates the SHA256-sum of thetar.gz-entry while I extract it (using the IReader extension WriteAllToDirectory)This seems to work without issues, but somtimes (due to CryptoStreams internal implementation), the
tar.gzEntryStream will throw aNotSupportedExceptionwhen the CryptoStream is being Disposed, because it will sometimes callFlush()on the EntryStream (see here).From what I can see there is no reason to not allow flushing the EntryStream, as there is nothing to flush. Microsoft also mentions in the Stream.Flush-documentation that read-only streams should implement Flush with an empty method.
This pull request fixes that, and also adds a test that "provokes" this issue (not sure if that is needed or wanted)