From 9217b16623112ef3ee0c0d175e17e506203bf1f9 Mon Sep 17 00:00:00 2001 From: George Goodall Date: Tue, 17 Dec 2024 11:20:41 +0000 Subject: [PATCH] improve prepare entry param validation --- src/middleware/entryIssueDetails.middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/entryIssueDetails.middleware.js b/src/middleware/entryIssueDetails.middleware.js index 1a3e448c..ac7a0c38 100644 --- a/src/middleware/entryIssueDetails.middleware.js +++ b/src/middleware/entryIssueDetails.middleware.js @@ -61,7 +61,7 @@ export const setRecordCount = (req, res, next) => { export const prepareEntry = (req, res, next) => { const { resources, entryIssues } = req - if (!entryIssues[0] || !resources) { + if (!entryIssues || entryIssues.length === 0 || !resources || resources.length === 0) { const error = new Error('Missing required values on request object') error.status = 404 return next(error)