fix(restore): guarantee cleanup of uploaded backup archive

Wrap temp-dir removal in removeTempDir() so a failed rmSync cannot hang the async restore handler and leave the archive on disk, close the peek stream descriptor, and clean wido-up-*/wido-rst-* on response finish and the missing-file path.
This commit is contained in:
dev
2026-10-23 11:41:57 +03:00
parent 7d610c549e
commit 08e99e0c09
2 changed files with 36 additions and 17 deletions
+7
View File
@@ -81,6 +81,12 @@ function tarEntryFilter(root) {
};
}
function removeTempDir(dir) {
try {
if (dir) fs.rmSync(dir, { recursive: true, force: true });
} catch {}
}
function sweepRestoreTempDirs() {
let names = [];
try {
@@ -111,5 +117,6 @@ module.exports = {
isDiskFullError,
isEntryInside,
tarEntryFilter,
removeTempDir,
sweepRestoreTempDirs,
};