Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solid Multipart RAR4.x archive - Fails but works with 2 comments. #419

Closed
Nanook opened this issue Oct 10, 2018 · 2 comments
Closed

Solid Multipart RAR4.x archive - Fails but works with 2 comments. #419

Nanook opened this issue Oct 10, 2018 · 2 comments

Comments

@Nanook
Copy link
Collaborator

Nanook commented Oct 10, 2018

Solid Multipart RAR4.x archive fails to decompress due to 2 if statements intentionally throwing exceptions. When these 2 checks are commented out the archive extracts without issue.

I have tried various other approaches that all failed. Either complaining that it is solid and to use ExtractAllFiles(). When Trying ExtractAllFiles it complained that it was MultiVolume.

My successful test was using the following method.

 IArchive archive = ArchiveFactory.Open(@"PathAndFilename"); //handles multipart archives
 archive.WriteToDirectory(@"c:\test");

and commenting out the following code:

    public static class IArchiveEntryExtensions
    {
        public static void WriteTo(this IArchiveEntry archiveEntry, Stream streamToWriteTo)
        {
            //Nanook
            //if (archiveEntry.Archive.Type == ArchiveType.Rar && archiveEntry.Archive.IsSolid)
            //{
            //    throw new InvalidFormatException("Cannot use Archive random access on SOLID Rar files.");
            //}

and in RarArchiveEntry.cs

        public Stream OpenEntryStream()
        {
            //Nanook
            //if (archive.IsSolid)
            //{
            //    throw new InvalidOperationException("Use ExtractAllEntries to extract SOLID archives.");
            //}

I realise there's probably a legitimate reason for these checks. I just wanted to raise this for consideration.

Thanks for a great compression library.

@Nanook Nanook changed the title Solid Multipart RAR4.x archive - Fails but works with a 2 comments. Solid Multipart RAR4.x archive - Fails but works with 2 comments. Oct 10, 2018
@adamhathcock
Copy link
Owner

I guess I didn't cover the scenario of multi-volume and SOLID.

Any chance you can contribute a test case in a PR then I can fill in the code?

@adamhathcock
Copy link
Owner

Fixed by #523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants