From eb71bc65a2d9faefbf08dc24c911c3bcc0176c5d Mon Sep 17 00:00:00 2001 From: Cookiezaurs Date: Wed, 25 Sep 2024 14:16:22 +0300 Subject: [PATCH] Nullchecks on report manager endpoints if query is not passed/invalid --- api/utils/requestProcessor.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/utils/requestProcessor.js b/api/utils/requestProcessor.js index 92e14f86690..58d76baec1a 100755 --- a/api/utils/requestProcessor.js +++ b/api/utils/requestProcessor.js @@ -1824,6 +1824,9 @@ const processRequest = (params) => { switch (paths[3]) { case 'all': validateRead(params, 'core', () => { + if (!params.qstring.query) { + params.qstring.query = {}; + } if (typeof params.qstring.query === "string") { try { params.qstring.query = JSON.parse(params.qstring.query); @@ -1864,6 +1867,9 @@ const processRequest = (params) => { break; case 'count': validateRead(params, 'core', () => { + if (!params.qstring.query) { + params.qstring.query = {}; + } if (typeof params.qstring.query === "string") { try { params.qstring.query = JSON.parse(params.qstring.query); @@ -1896,6 +1902,9 @@ const processRequest = (params) => { break; case 'list': validateRead(params, 'core', () => { + if (!params.qstring.query) { + params.qstring.query = {}; + } if (typeof params.qstring.query === "string") { try { params.qstring.query = JSON.parse(params.qstring.query);