diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-06-04 03:30:10 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-06-04 03:30:10 +0300 |
commit | 40206d2ede1c9963c4e4f718e1e203e5d901af73 (patch) | |
tree | 06f185de3bf8ca6b903b85e184c30e64afc75e75 /api/routes/announceZBlock | |
parent | b35833cadff3a4e9346cb97ae3628f6c5b4e6bf9 (diff) | |
download | arching-kaos-tools-40206d2ede1c9963c4e4f718e1e203e5d901af73.tar.gz arching-kaos-tools-40206d2ede1c9963c4e4f718e1e203e5d901af73.tar.bz2 arching-kaos-tools-40206d2ede1c9963c4e4f718e1e203e5d901af73.zip |
Extra validation
Diffstat (limited to 'api/routes/announceZBlock')
-rw-r--r-- | api/routes/announceZBlock/index.js | 8 |
1 files changed, 4 insertions, 4 deletions
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"}); } |