Send 500 if no key found

This commit is contained in:
Yarmo Mackenbach 2021-10-19 15:45:22 +02:00
parent 29ccb63bf1
commit 9eb4069253
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -198,7 +198,7 @@ const sanitize = (data) => {
let results = [] let results = []
const dataClone = JSON.parse(JSON.stringify(data)) const dataClone = JSON.parse(JSON.stringify(data))
for (let iUser = 0; iUser < dataClone.keyData.users.length; iUser++) { for (let iUser = 0; iUser < dataClone.keyData.users.length; iUser++) {
const user = dataClone.keyData.users[iUser] const user = dataClone.keyData.users[iUser]
@ -258,6 +258,11 @@ router.get('/profile/fetch',
break; break;
} }
if (data.errors.length > 0) {
delete data.key
res.status(500).send(data)
}
// Return public key // Return public key
if (req.query.returnPublicKey) { if (req.query.returnPublicKey) {
data.keyData.key.data = data.key.publicKey data.keyData.key.data = data.key.publicKey