Compare commits

..

No commits in common. "0f2e8d5567d062b8dbee3d21338af2da625ca436" and "ed0070c71190b0f0385029e80b8100e6e14f9c89" have entirely different histories.

2 changed files with 16 additions and 81 deletions

View File

@ -1,6 +1,6 @@
{
"name": "real-debrid-downloader",
"version": "1.7.27",
"version": "1.7.26",
"description": "Desktop downloader",
"main": "build/main/main/main.js",
"author": "Sucukdeluxe",

View File

@ -1718,35 +1718,6 @@ async function resolveExtractorCommand(): Promise<string> {
}
}
function is7zCommand(command: string): boolean {
const lower = command.toLowerCase();
return lower.includes("7z") && !lower.includes("unrar") && !lower.includes("winrar");
}
function isUnrarCommand(command: string): boolean {
const lower = command.toLowerCase();
return lower.includes("unrar") || lower.includes("winrar");
}
async function findAlternativeExtractor(currentCommand: string): Promise<string | null> {
const candidates = nativeExtractorCandidates();
const currentIs7z = is7zCommand(currentCommand);
for (const candidate of candidates) {
if (candidate === currentCommand) continue;
// If current is 7z, look for UnRAR/WinRAR. If current is UnRAR, look for 7z.
if (currentIs7z && !isUnrarCommand(candidate)) continue;
if (!currentIs7z && !is7zCommand(candidate)) continue;
if (isAbsoluteCommand(candidate) && !fs.existsSync(candidate)) continue;
const lower = candidate.toLowerCase();
const probeArgs = (lower.includes("winrar") || lower.includes("unrar")) ? ["-?"] : ["?"];
const probe = await runExtractCommand(candidate, probeArgs, undefined, undefined, EXTRACTOR_PROBE_TIMEOUT_MS);
if (probe.ok || (!probe.missingCommand && !probe.timedOut)) {
return candidate;
}
}
return null;
}
async function runExternalExtract(
archivePath: string,
targetDir: string,
@ -1844,58 +1815,22 @@ async function runExternalExtract(
const command = await resolveExtractorCommand();
const legacyStartedAt = Date.now();
let password: string;
let usedCommand = command;
try {
password = await runExternalExtractInner(
command,
archivePath,
effectiveTargetDir,
conflictMode,
passwordCandidates,
onArchiveProgress,
signal,
timeoutMs,
hybridMode,
onPasswordAttempt,
forceFlatMode,
flatModeResult
);
} catch (primaryError) {
// If the primary extractor (typically 7-Zip) fails on a RAR archive,
// try the alternative extractor (UnRAR/WinRAR) which handles RAR natively.
const isRar = /\.rar$/i.test(archiveName) || /\.r\d{2,3}$/i.test(archiveName);
const errText = String((primaryError as Error)?.message || primaryError || "");
const isPasswordOrCorrupt = /wrong.password|checksum error|corrupt/i.test(errText);
if (isRar && isPasswordOrCorrupt && !signal?.aborted) {
const alt = await findAlternativeExtractor(command);
if (alt) {
const altName = path.basename(alt).replace(/\.exe$/i, "");
logger.info(`Legacy-Fallback: ${path.basename(command)} fehlgeschlagen bei RAR, versuche ${altName}: ${archiveName}`);
usedCommand = alt;
password = await runExternalExtractInner(
alt,
archivePath,
effectiveTargetDir,
conflictMode,
passwordCandidates,
onArchiveProgress,
signal,
timeoutMs,
hybridMode,
onPasswordAttempt,
forceFlatMode,
flatModeResult
);
} else {
throw primaryError;
}
} else {
throw primaryError;
}
}
const password = await runExternalExtractInner(
command,
archivePath,
effectiveTargetDir,
conflictMode,
passwordCandidates,
onArchiveProgress,
signal,
timeoutMs,
hybridMode,
onPasswordAttempt,
forceFlatMode,
flatModeResult
);
const legacyMs = Date.now() - legacyStartedAt;
const extractorName = path.basename(usedCommand).replace(/\.exe$/i, "");
const extractorName = path.basename(command).replace(/\.exe$/i, "");
if (jvmFailureReason) {
logger.info(`Entpackt via legacy/${extractorName} (nach JVM-Fehler): ${archiveName}`);
} else {