Fix:Crash for invalid payload to update cover endpoint #1644

This commit is contained in:
advplyr 2023-04-09 15:01:14 -05:00
parent 3dc9416da6
commit 22b8622c67

View File

@ -162,12 +162,12 @@ class LibraryItemController {
// PATCH: api/items/:id/cover
async updateCover(req, res) {
var libraryItem = req.libraryItem
const libraryItem = req.libraryItem
if (!req.body.cover) {
return res.status(400).error('Invalid request no cover path')
return res.status(400).send('Invalid request no cover path')
}
var validationResult = await this.coverManager.validateCoverPath(req.body.cover, libraryItem)
const validationResult = await this.coverManager.validateCoverPath(req.body.cover, libraryItem)
if (validationResult.error) {
return res.status(500).send(validationResult.error)
}