mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-09 21:24:08 +00:00
[PR #638] Rar2 fix with new unit tests that fail on previous build. #1136
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/638
State: closed
Merged: Yes
I noticed files within WinRar2.8 archives were not decompressing properly. Some were fine, others were fine at the start then corrupt half way through the file. I was able to reproduce this behaviour by using WinRar2.8 to create SharpCompress test archives.
After debugging the streams to confirm the RAR compressed parts were being extracted correctly, I noticed it was the decoding that was failing. I stumbled upon
RarEntry.IsRarV3property and addedFileHeader.CompressionAlgorithm == 20 || FileHeader.CompressionAlgorithm == 26to the logic. This forces it to use the UnpackV1 code rather than UnpackV2017. This fixes it.This PR also includes the UnitTests and Archives. Hopefully it will be useful
I think it fixes this issue also: https://github.com/adamhathcock/sharpcompress/issues/619
Thanks.