filesystem: remove hook should not rm recursively

this causes a bug in the backupcleaner when it tries to prune
empty directories when using the filesystem backend.

the bug is hit when a box backup is getting cleaned up but
one or more app backups are preserved.
This commit is contained in:
Girish Ramakrishnan
2024-01-24 21:24:39 +01:00
parent 2d1e0ec890
commit 243a254f3e

View File

@@ -201,7 +201,7 @@ async function remove(apiConfig, filename) {
if (stat.isFile()) {
if (!safe.fs.unlinkSync(filename)) throw new BoxError(BoxError.EXTERNAL_ERROR, safe.error.message);
} else if (stat.isDirectory()) {
if (!safe.fs.rmSync(filename, { recursive: true })) throw new BoxError(BoxError.EXTERNAL_ERROR, safe.error.message);
if (!safe.fs.rmdirSync(filename, { recursive: false })) throw new BoxError(BoxError.EXTERNAL_ERROR, safe.error.message);
}
}