Invalid Rar Header: 3 #179

Closed
opened 2026-01-29 22:07:52 +00:00 by claunia · 7 comments
Owner

Originally created by @SkyLeite on GitHub (May 23, 2017).

Hey, could I get a hand please? I'm trying to extract this one rar file, but when opening it with RarArchive.Open() I get the exception Invalid Rar Header: 3. I can extract it no problem with both WinRAR and 7Zip, so I believe there's something I can do to be able to extract this file. Any ideas?

Code:

using (var archive = RarArchive.Open(Path.Combine("Temp/", file)))
{
    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
    {
        entry.WriteToDirectory("Temp2/", new ExtractionOptions()
        {
            ExtractFullPath = true,
            Overwrite = true
        });
    }
}

File: patch.zip

Originally created by @SkyLeite on GitHub (May 23, 2017). Hey, could I get a hand please? I'm trying to extract this one rar file, but when opening it with `RarArchive.Open()` I get the exception `Invalid Rar Header: 3`. I can extract it no problem with both WinRAR and 7Zip, so I believe there's something I can do to be able to extract this file. Any ideas? Code: ``` using (var archive = RarArchive.Open(Path.Combine("Temp/", file))) { foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory("Temp2/", new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } ``` File: [patch.zip](https://github.com/adamhathcock/sharpcompress/files/1022368/patch.zip)
Author
Owner

@adamhathcock commented on GitHub (May 23, 2017):

Might be a RAR5 file. The format changed and I haven't implemented it.

@adamhathcock commented on GitHub (May 23, 2017): Might be a RAR5 file. The format changed and I haven't implemented it.
Author
Owner

@SkyLeite commented on GitHub (May 23, 2017):

Ah, ok. Any ETAs on when that'll be implemented?

@SkyLeite commented on GitHub (May 23, 2017): Ah, ok. Any ETAs on when that'll be implemented?
Author
Owner

@adamhathcock commented on GitHub (May 23, 2017):

Oh wait, you're giving a zip file and using RarArchive.Open on it? That's not going to work.

@adamhathcock commented on GitHub (May 23, 2017): Oh wait, you're giving a zip file and using `RarArchive.Open` on it? That's not going to work.
Author
Owner

@adamhathcock commented on GitHub (May 23, 2017):

No, no ETA

@adamhathcock commented on GitHub (May 23, 2017): No, no ETA
Author
Owner

@SkyLeite commented on GitHub (May 23, 2017):

Oh, you're right. I didn't realize it was a zip and not a rar. Maybe make that exception a bit clearer in the future? Either way, thanks for the help :)

@SkyLeite commented on GitHub (May 23, 2017): Oh, you're right. I didn't realize it was a zip and not a rar. Maybe make that exception a bit clearer in the future? Either way, thanks for the help :)
Author
Owner

@adamhathcock commented on GitHub (May 23, 2017):

Well, it's plenty clear. It was an invalid rar header because it's a zip file :)

@adamhathcock commented on GitHub (May 23, 2017): Well, it's plenty clear. It was an invalid rar header because it's a zip file :)
Author
Owner

@SkyLeite commented on GitHub (May 23, 2017):

Fair enough

@SkyLeite commented on GitHub (May 23, 2017): Fair enough
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#179