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:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user