7zip-cpp icon indicating copy to clipboard operation
7zip-cpp copied to clipboard

Non zip compression format detection doesn't seem to work (with fix)

Open Levoila opened this issue 4 years ago • 2 comments

Hi,

I had a 7z file to extract but SevenZipExtractor::DetectCompressionFormat would think that the format was CompressionFormat::Lzma86 instead of CompressionFormat::SevenZip.

The format is detected is by trying to open the archive with each type consecutively until the archive opens correctly (link to source) but the file is not seeked to the beginning after each iteration, seemingly leading to no/incorrect detection for all but zip formats.

Seeking the file to the beginning before each iteration with fileStream->Seek({}, STREAM_SEEK_SET, nullptr); seems to fix the issue.

Levoila avatar Mar 06 '20 18:03 Levoila

Interesting catch, seems like you know where to place the fix, if you make a pull request I'll merge it :)

getnamo avatar Mar 06 '20 23:03 getnamo

merged https://github.com/getnamo/7zip-cpp/pull/46

getnamo avatar Mar 09 '20 19:03 getnamo