Fix zip volume cleanup regex and atomic progress file writes
Build and Release / build (push) Has been cancelled

- 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
co-authored by Claude Opus 4.6
parent ca05fa184d
commit 14d5a3abb4
2 changed files with 5 additions and 3 deletions
+4 -2
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);
}