pull/22/head
tycrek 3 years ago
parent 3446bc7da9
commit 130876c43e
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -18,7 +18,7 @@ router.use((req, res, next) => {
// If the ID is invalid, return 404. Otherwise, continue normally // If the ID is invalid, return 404. Otherwise, continue normally
data.has(req.ass.resourceId) data.has(req.ass.resourceId)
.then((has) => has ? next() : res.sendStatus(CODE_NOT_FOUND)) .then((has) => has ? next() : res.sendStatus(CODE_NOT_FOUND)) // skipcq: JS-0229
.catch(next); .catch(next);
}); });
@ -98,7 +98,7 @@ router.get('/oembed', (req, res, next) =>
// Delete file // Delete file
router.get('/delete/:deleteId', (req, res, next) => { router.get('/delete/:deleteId', (req, res, next) => {
let oldName, oldType; let oldName, oldType; // skipcq: JS-0119
data.get(req.ass.resourceId) data.get(req.ass.resourceId)
.then((fileData) => { .then((fileData) => {
// Extract info for logs // Extract info for logs
@ -115,7 +115,7 @@ router.get('/delete/:deleteId', (req, res, next) => {
return Promise.all([s3enabled ? deleteS3(fileData) : fs.rmSync(path(fileData.path)), fs.rmSync(path(diskFilePath, 'thumbnails/', fileData.thumbnail))]); return Promise.all([s3enabled ? deleteS3(fileData) : fs.rmSync(path(fileData.path)), fs.rmSync(path(diskFilePath, 'thumbnails/', fileData.thumbnail))]);
}) })
.then(() => data.del(req.ass.resourceId)) .then(() => data.del(req.ass.resourceId))
.then(() => (log(`Deleted: ${oldName} (${oldType})`), res.type('text').send('File has been deleted!'))) .then(() => (log(`Deleted: ${oldName} (${oldType})`), res.type('text').send('File has been deleted!'))) // skipcq: JS-0090
.catch(next); .catch(next);
}); });

Loading…
Cancel
Save