Fix hybrid-extract multi-part archive + extractor CRC handling

- findReadyArchiveSets: for .part1.rar, require ALL package items
  to be terminal before allowing extraction (prevents premature
  extraction when later parts have no targetPath/fileName yet)
- JVM extractor: remove CRCERROR from isPasswordFailure() — only
  DATAERROR indicates wrong password. CRCERROR on archives where
  7z-JBinding falsely reports encrypted no longer triggers password
  cycling.
- looksLikeWrongPassword: remove CRC text matching, keep only
  explicit "data error" for encrypted archives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-03 14:52:00 +01:00
co-authored by Claude Opus 4.6
parent 0cf5ebe5e9
commit 1fde0a9951
10 changed files with 22 additions and 2 deletions
@@ -356,7 +356,10 @@ public final class JBindExtractorMain {
if (!encrypted || result == null) {
return false;
}
return result == ExtractOperationResult.CRCERROR || result == ExtractOperationResult.DATAERROR;
// Only DATAERROR reliably indicates wrong password. CRCERROR can also mean
// a genuinely corrupt or incomplete archive, and 7z-JBinding sometimes
// falsely reports encrypted=true for non-encrypted RAR files.
return result == ExtractOperationResult.DATAERROR;
}
private static boolean looksLikeWrongPassword(Throwable error, boolean encrypted) {
@@ -367,7 +370,9 @@ public final class JBindExtractorMain {
if (text.contains("wrong password") || text.contains("falsches passwort")) {
return true;
}
return encrypted && (text.contains("crc") || text.contains("data error") || text.contains("checksum"));
// Only "data error" suggests wrong password. CRC errors can also mean
// corrupt/incomplete archives, so we don't treat them as password failures.
return encrypted && text.contains("data error");
}
private static boolean shouldUseZip4j(File archiveFile) {