fix: multiple cid filter on flags page

if multiple categories were selected it wasnt applied because of typeof string check
isekai-main
Barış Soner Uşaklı 3 years ago
parent 693ca1f11f
commit 3e8cb732c5

@ -36,9 +36,11 @@ modsController.flags.list = async function (req, res) {
// Parse query string params for filters, eliminate non-valid filters // Parse query string params for filters, eliminate non-valid filters
filters = filters.reduce((memo, cur) => { filters = filters.reduce((memo, cur) => {
if (req.query.hasOwnProperty(cur) && typeof req.query[cur] === 'string') { if (req.query.hasOwnProperty(cur)) {
if (req.query[cur].trim() !== '') { if (typeof req.query[cur] === 'string' && req.query[cur].trim() !== '') {
memo[cur] = req.query[cur].trim(); memo[cur] = req.query[cur].trim();
} else if (Array.isArray(req.query[cur]) && req.query[cur].length) {
memo[cur] = req.query[cur];
} }
} }

Loading…
Cancel
Save