adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.25k stars 479 forks source link

RAR archive mistaken as Tar archive #89

Closed elgonzo closed 8 years ago

elgonzo commented 9 years ago

SharpCompress will not open and read the following RAR file correctly:

RAR file download link:http://wikisend.com/download/295490/RAR_identified_as_Tar.rar Password: adamhathcock (The download link expires after 90 days!)

The RAR archive is NOT in RAR5 format, and it contains only one file "PROTONIX.D64".

ArchiveFactory.Open(...) will return a SharpCompress.Archive.Tar.TarArchive instance for this RAR file. And ReaderFactory.Open(...) will return a SharpCompress.Reader.Tar.TarReader.

SharpCompress version used: 0.11.1

elgonzo commented 9 years ago

I guess the file format check should be changed so that Tar is tested after other archive format tests such as RAR, 7z, GZip, etc...

In ArchiveFactory: https://github.com/adamhathcock/sharpcompress/blob/master/SharpCompress/Archive/ArchiveFactory.cs#L129 In ReaderFactory: https://github.com/adamhathcock/sharpcompress/blob/master/SharpCompress/Reader/ReaderFactory.cs#L65

adamhathcock commented 8 years ago

Did your suggestion: https://github.com/adamhathcock/sharpcompress/commit/21087323af2caa5cfb394eee30ecd919b68421c6