Fix JVM extractor not falling back to legacy UnRAR on codec errors

When SevenZipJBinding reports "Archive file can't be opened with any
of the registered codecs", the extractor now falls back to legacy
UnRAR instead of failing immediately. Previously, backend mode "jvm"
(the production default) only allowed fallback for UNSUPPORTEDMETHOD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-03 21:28:47 +01:00
parent 3dbb94d298
commit 6ee98328fb
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "real-debrid-downloader",
"version": "1.5.68",
"version": "1.5.69",
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
"main": "build/main/main/main.js",
"author": "Sucukdeluxe",

View File

@ -1289,12 +1289,19 @@ async function runExternalExtract(
}
jvmFailureReason = jvmResult.errorText || "JVM-Extractor fehlgeschlagen";
const jvmFailureLower = jvmFailureReason.toLowerCase();
const isUnsupportedMethod = jvmFailureReason.includes("UNSUPPORTEDMETHOD");
if (backendMode === "jvm" && !isUnsupportedMethod) {
const isCodecError = jvmFailureLower.includes("registered codecs")
|| jvmFailureLower.includes("can not open")
|| jvmFailureLower.includes("cannot open archive");
const shouldFallbackToLegacy = isUnsupportedMethod || isCodecError;
if (backendMode === "jvm" && !shouldFallbackToLegacy) {
throw new Error(jvmFailureReason);
}
if (isUnsupportedMethod) {
logger.warn(`JVM-Extractor: Komprimierungsmethode nicht unterstützt, fallback auf Legacy: ${path.basename(archivePath)}`);
} else if (isCodecError) {
logger.warn(`JVM-Extractor: Archiv-Format nicht erkannt, fallback auf Legacy: ${path.basename(archivePath)}`);
} else {
logger.warn(`JVM-Extractor Fehler, fallback auf Legacy: ${jvmFailureReason}`);
}