mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Fix data validation
This commit is contained in:
parent
2b435080ba
commit
3f48cc55ba
1 changed files with 3 additions and 3 deletions
|
@ -116,7 +116,7 @@ const apiProfileSchema = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
claim: {
|
claim: {
|
||||||
type: "object",
|
type: ["array", "object"],
|
||||||
properties: {
|
properties: {
|
||||||
format: { type: "string" },
|
format: { type: "string" },
|
||||||
relation: { type: "string" },
|
relation: { type: "string" },
|
||||||
|
@ -328,7 +328,7 @@ router.get('/profile/fetch',
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Sanitize JSON
|
// Sanitize JSON
|
||||||
data = sanitize(data);
|
data = sanitize(data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
data.keyData = {}
|
data.keyData = {}
|
||||||
data.extra = {}
|
data.extra = {}
|
||||||
|
@ -350,7 +350,7 @@ router.get('/profile/fetch',
|
||||||
router.get('/profile/verify',
|
router.get('/profile/verify',
|
||||||
check('data').exists().isJSON(),
|
check('data').exists().isJSON(),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const valRes = validationResult(req);
|
const valRes = validationResult(req)
|
||||||
if (!valRes.isEmpty()) {
|
if (!valRes.isEmpty()) {
|
||||||
res.status(400).send(valRes)
|
res.status(400).send(valRes)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue