From 9eb4069253f063a43a34c06a87a72d884dddadda Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 19 Oct 2021 15:45:22 +0200 Subject: [PATCH] Send 500 if no key found --- api/v0/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/v0/index.js b/api/v0/index.js index 68e2793..141c8e0 100644 --- a/api/v0/index.js +++ b/api/v0/index.js @@ -198,7 +198,7 @@ const sanitize = (data) => { let results = [] const dataClone = JSON.parse(JSON.stringify(data)) - + for (let iUser = 0; iUser < dataClone.keyData.users.length; iUser++) { const user = dataClone.keyData.users[iUser] @@ -258,6 +258,11 @@ router.get('/profile/fetch', break; } + if (data.errors.length > 0) { + delete data.key + res.status(500).send(data) + } + // Return public key if (req.query.returnPublicKey) { data.keyData.key.data = data.key.publicKey