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/announceZChain/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'api/routes/announceZChain') diff --git a/api/routes/announceZChain/index.js b/api/routes/announceZChain/index.js index 092b6a9..91ac5b9 100644 --- a/api/routes/announceZChain/index.js +++ b/api/routes/announceZChain/index.js @@ -36,10 +36,11 @@ const getNSvalidity = require('../../validators/ZchainValidator') module.exports = (req, res) => { console.log(req); - if ( (req.body.zchain) && req.body.zchain.length === 62 ){//&& req.body.block_signature.length === 46){ + if ( (req.body.zchain) && typeof req.body.zchain === "string" && req.body.zchain.length === 62 ){ + let zchain = req.body.zchain; regex= /k51qzi5uqu5d[A-Za-z0-9]{50}/ - if (regex.test(req.body.zchain)){ // && regex.test(req.body.block_signature)){ - getNSvalidity(req.body.zchain,res); + if (regex.test(zchain)){ + getNSvalidity(zchain,res); } else { res.send({error:"Invalid data"}); } -- cgit v1.2.3