feat: borra los dms sin file y elimina registros aunq no se pueda eliminar la carpeta
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-11-08 12:48:09 +01:00
parent f65a90927f
commit 9890db820b
1 changed files with 6 additions and 4 deletions

View File

@ -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);
}
};
};