fixed failing to remove resource when thumbnail doesn't exist (probably)

pull/29/head
tycrek 3 years ago
parent 3b80b024ab
commit d28d3f2254
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -112,7 +112,7 @@ router.get('/delete/:deleteId', (req, res, next) => {
if (deleteId !== fileData.deleteId) return res.sendStatus(CODE_UNAUTHORIZED);
// Save the file information
return Promise.all([s3enabled ? deleteS3(fileData) : fs.rmSync(path(fileData.path)), (!fileData.is || (fileData.is.image || fileData.is.video)) ? fs.rmSync(path(diskFilePath, 'thumbnails/', fileData.thumbnail)) : () => Promise.resolve()]);
return Promise.all([s3enabled ? deleteS3(fileData) : fs.rmSync(path(fileData.path)), (!fileData.is || (fileData.is.image || fileData.is.video)) ? fs.rmSync(path(diskFilePath, 'thumbnails/', fileData.thumbnail)).catch((err) => ({})) : () => Promise.resolve()]);
})
.then(() => data.del(req.ass.resourceId))
.then(() => (log.success('Deleted', oldName, oldType), res.type('text').send('File has been deleted!'))) // skipcq: JS-0090

Loading…
Cancel
Save