Only allow extract all on archives that are solid (some rars and 7zip only)#964
Merged
adamhathcock merged 5 commits intomasterfrom Oct 21, 2025
Merged
Only allow extract all on archives that are solid (some rars and 7zip only)#964adamhathcock merged 5 commits intomasterfrom
adamhathcock merged 5 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR restricts the use of ExtractAllEntries() to only solid archives (some RAR formats) and 7Zip archives, throwing an explicit exception for non-solid archives. This addresses issue #960 by preventing misuse of the API on archive types that don't require sequential extraction.
Key Changes:
- Added validation in
ExtractAllEntries()to throwInvalidOperationExceptionfor non-solid, non-7Zip archives - Refactored test code to use
ReaderFactory.Open()directly instead ofArchiveFactory.Open()followed byExtractAllEntries() - Added convenience
Open()methods toReaderFactoryandRarReaderfor file path inputs
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/SharpCompress/Archives/AbstractArchive.cs | Added validation check to prevent ExtractAllEntries() on non-solid, non-7Zip archives |
| src/SharpCompress/Archives/IArchiveExtensions.cs | Changed ExtractToDirectory() to iterate archive entries directly instead of using ExtractAllEntries() |
| src/SharpCompress/Readers/ReaderFactory.cs | Added Open() overloads accepting file paths and FileInfo objects |
| src/SharpCompress/Readers/Rar/RarReader.cs | Added Open() overloads for single and multiple file paths |
| tests/SharpCompress.Test/ArchiveTests.cs | Updated tests to use direct entry iteration and removed redundant method overload |
| tests/SharpCompress.Test/Zip/ZipArchiveTests.cs | Replaced ArchiveFactory.Open() + ExtractAllEntries() with ReaderFactory.Open() |
| tests/SharpCompress.Test/Zip/ZipReaderTests.cs | Updated test to use ReaderFactory.Open() directly and added clarifying comment |
| tests/SharpCompress.Test/Rar/RarReaderTests.cs | Changed to use RarReader.Open() with explicit file list instead of archive |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 task
This was referenced Nov 28, 2025
This was referenced Dec 8, 2025
This was referenced Dec 15, 2025
This was referenced Dec 22, 2025
This was referenced Dec 22, 2025
This was referenced Jan 5, 2026
This was referenced Jan 12, 2026
This was referenced Jan 19, 2026
This was referenced Jan 26, 2026
This was referenced Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explicit exception for #960