Fix req.query check and response

This commit is contained in:
advplyr 2025-03-18 17:03:43 -05:00
parent 3c9966e849
commit 1def32aa50

View File

@ -1424,7 +1424,7 @@ class LibraryController {
* GET: /api/library/:id/download * GET: /api/library/:id/download
* Downloads multiple library items * Downloads multiple library items
* *
* @param {LibraryItemControllerRequest} req * @param {LibraryControllerRequest} req
* @param {Response} res * @param {Response} res
*/ */
async downloadMultiple(req, res) { async downloadMultiple(req, res) {
@ -1433,8 +1433,9 @@ class LibraryController {
return res.sendStatus(403) return res.sendStatus(403)
} }
if(req.query.ids === undefined || req.query.ids === '') { if (!req.query.ids || typeof req.query.ids !== 'string') {
res.status(400).send('Library items not found') res.status(400).send('Invalid request. ids must be a string')
return
} }
const itemIds = req.query.ids.split(',') const itemIds = req.query.ids.split(',')
@ -1467,7 +1468,6 @@ class LibraryController {
} }
} }
/** /**
* *
* @param {RequestWithUser} req * @param {RequestWithUser} req