aboutsummaryrefslogtreecommitdiff
path: root/api/routes/announceZBlock
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-06-04 03:30:10 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-06-04 03:30:10 +0300
commit40206d2ede1c9963c4e4f718e1e203e5d901af73 (patch)
tree06f185de3bf8ca6b903b85e184c30e64afc75e75 /api/routes/announceZBlock
parentb35833cadff3a4e9346cb97ae3628f6c5b4e6bf9 (diff)
downloadarching-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.js8
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"});
}