Check for array in non hash prefix method

This commit is contained in:
Ajay Ramachandran 2021-05-13 14:59:12 -04:00
parent 60a118f391
commit 0c64f4b006

View file

@ -266,6 +266,10 @@ async function handleGetSegments(req: Request, res: Response): Promise<Segment[]
: req.query.category
? [req.query.category]
: ['sponsor'];
if (!Array.isArray(categories)) {
res.status(400).send("Categories parameter does not match format requirements.");
return false;
}
let service: Service = req.query.service ?? req.body.service ?? Service.YouTube;
if (!Object.values(Service).some((val) => val == service)) {