From 3f48cc55ba238b034a928eb97b3a3a8a142e9ea0 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 27 Oct 2022 12:29:32 +0200 Subject: [PATCH] Fix data validation --- api/v0/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v0/index.js b/api/v0/index.js index a129ed4..83832f0 100644 --- a/api/v0/index.js +++ b/api/v0/index.js @@ -116,7 +116,7 @@ const apiProfileSchema = { } }, claim: { - type: "object", + type: ["array", "object"], properties: { format: { type: "string" }, relation: { type: "string" }, @@ -328,7 +328,7 @@ router.get('/profile/fetch', try { // Sanitize JSON - data = sanitize(data); + data = sanitize(data) } catch (error) { data.keyData = {} data.extra = {} @@ -350,7 +350,7 @@ router.get('/profile/fetch', router.get('/profile/verify', check('data').exists().isJSON(), async (req, res) => { - const valRes = validationResult(req); + const valRes = validationResult(req) if (!valRes.isEmpty()) { res.status(400).send(valRes) return