fix: lokale Dump-Datei immer löschen (try/finally)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:23:05 +02:00
parent 43ddbbcf72
commit 00a3f02d80
+4 -1
View File
@@ -77,6 +77,7 @@ async function runBackup(): Promise<void> {
await dumpToFile(localPath); await dumpToFile(localPath);
console.log(`[backup] Dump geschrieben: ${localPath}`); console.log(`[backup] Dump geschrieben: ${localPath}`);
try {
if (!sshUrl) return; if (!sshUrl) return;
const match = sshUrl.match(/^([^:]+):(.+)$/); const match = sshUrl.match(/^([^:]+):(.+)$/);
@@ -115,7 +116,6 @@ async function runBackup(): Promise<void> {
); );
}); });
unlinkSync(localPath);
console.log(`[backup] ${filename}${sshHost}:${remotePath}`); console.log(`[backup] ${filename}${sshHost}:${remotePath}`);
// Backups älter als 30 Tage auf Remote löschen // Backups älter als 30 Tage auf Remote löschen
@@ -130,4 +130,7 @@ async function runBackup(): Promise<void> {
resolve(); resolve();
}); });
}); });
} finally {
try { unlinkSync(localPath); } catch { /* bereits gelöscht oder nie angelegt */ }
}
} }