From 22b8622c677db777f1a6c1ac88c811dafbf87b77 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 9 Apr 2023 15:01:14 -0500 Subject: [PATCH] Fix:Crash for invalid payload to update cover endpoint #1644 --- server/controllers/LibraryItemController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index d26f57f2..55bbe72b 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -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) }