Fix zip volume cleanup regex and atomic progress file writes
Some checks are pending
Build and Release / build (push) Waiting to run

- Fix .z001/.z002 split zip volumes not deleted after extraction
  (regex matched only 2-digit, now matches 2-3 digit volumes)
- Make extract progress file writes atomic (write to .tmp then rename)
  to prevent corruption on crash during extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-02 10:51:49 +01:00
parent ca05fa184d
commit 14d5a3abb4
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -272,7 +272,9 @@ async function writeExtractResumeState(packageDir: string, completedArchives: Se
.map((name) => archiveNameKey(name))
.sort((a, b) => a.localeCompare(b))
};
await fs.promises.writeFile(progressPath, JSON.stringify(payload, null, 2), "utf8");
const tmpPath = progressPath + ".tmp";
await fs.promises.writeFile(tmpPath, JSON.stringify(payload, null, 2), "utf8");
await fs.promises.rename(tmpPath, progressPath);
} catch (error) {
logger.warn(`ExtractResumeState schreiben fehlgeschlagen: ${String(error)}`);
}
@ -929,7 +931,7 @@ export function collectArchiveCleanupTargets(sourceArchivePath: string, director
if (/\.zip$/i.test(fileName)) {
const stem = escapeRegex(fileName.replace(/\.zip$/i, ""));
addMatching(new RegExp(`^${stem}\\.zip$`, "i"));
addMatching(new RegExp(`^${stem}\\.z\\d{2}$`, "i"));
addMatching(new RegExp(`^${stem}\\.z\\d{2,3}$`, "i"));
return Array.from(targets);
}