From 14d5a3abb461d3b88f6289a9e4fd53d0e9ce5108 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Mon, 2 Mar 2026 10:51:49 +0100 Subject: [PATCH] Fix zip volume cleanup regex and atomic progress file writes - 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 --- package.json | 2 +- src/main/extractor.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 14ea365..4f51fae 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main/extractor.ts b/src/main/extractor.ts index f0e159f..917aaec 100644 --- a/src/main/extractor.ts +++ b/src/main/extractor.ts @@ -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); }