feat(views/create): return error if filterBySource is invalid

This commit is contained in:
Aminejv 2022-09-12 13:46:20 +01:00
parent 2d3130840c
commit 4bced27f0c

View File

@ -18,6 +18,14 @@ export default async (req, res) => {
return res.status(403).send({ decorator: "SERVER_CREATE_VIEW_INVALID_DATA", error: true });
}
if (filterBySource) {
try {
new URL(filterBySource);
} catch (e) {
return res.status(403).send({ decorator: "SERVER_CREATE_VIEW_INVALID_DATA", error: true });
}
}
if (filterBySlateId) {
const slate = await Data.getSlateById({ id: filterBySlateId });
if (!slate) {