Fix:Upload API endpoint crashing on invalid request with no files #1473

This commit is contained in:
advplyr 2023-02-10 17:25:19 -06:00
parent e195eec1c5
commit 8f8d6f81ab

View File

@ -19,6 +19,10 @@ class MiscController {
Logger.warn('User attempted to upload without permission', req.user)
return res.sendStatus(403)
}
if (!req.files) {
Logger.error('Invalid request, no files')
return res.sendStatus(400)
}
var files = Object.values(req.files)
var title = req.body.title
var author = req.body.author