From 9890db820b69316e11de7255dd130d01fade298a Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 8 Nov 2022 12:48:09 +0100 Subject: [PATCH] feat: borra los dms sin file y elimina registros aunq no se pueda eliminar la carpeta --- back/methods/dms/deleteTrashFiles.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index 828f9658c..63d7021c5 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -47,20 +47,22 @@ module.exports = Self => { for (let dms of dmsToDelete) { const pathHash = DmsContainer.getHash(dms.id); const dmsContainer = await DmsContainer.container(pathHash); - const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); try { + const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); await fs.unlink(dstFile); } catch (err) { - continue; + if (err.code != 'ENOENT') + throw err; } + + await dms.destroy(myOptions); + const dstFolder = path.join(dmsContainer.client.root, pathHash); try { await fs.rmdir(dstFolder); } catch (err) { continue; } - - await dms.destroy(myOptions); } }; };