From 40206d2ede1c9963c4e4f718e1e203e5d901af73 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 4 Jun 2024 03:30:10 +0300 Subject: Extra validation --- api/routes/announceZBlock/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'api/routes/announceZBlock') diff --git a/api/routes/announceZBlock/index.js b/api/routes/announceZBlock/index.js index b395dbf..254e1dc 100644 --- a/api/routes/announceZBlock/index.js +++ b/api/routes/announceZBlock/index.js @@ -15,11 +15,11 @@ const getvalidity = require('../../validators/ZblockValidator') module.exports = (req, res) => { console.log(req); - console.log("okay we got called"); - if ( (req.body.zblock) && req.body.zblock.length === 46 ){ + if ( (req.body.zblock) && typeof req.body.zblock === "string" && req.body.zblock.length === 46 ){ + let zblock = req.body.zblock; regex= /Qm[A-Za-z0-9]{44}/; - if (regex.test(req.body.zblock)){ - getvalidity(req.body.zblock,res); + if (regex.test(zblock)){ + getvalidity(zblock,res); } else { res.send({error:"Invalid data"}); } -- cgit v1.2.3