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/getInnerIPFSContent | |
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/getInnerIPFSContent')
-rw-r--r-- | api/routes/getInnerIPFSContent/index.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/api/routes/getInnerIPFSContent/index.js b/api/routes/getInnerIPFSContent/index.js index e17d038..b3a05cb 100644 --- a/api/routes/getInnerIPFSContent/index.js +++ b/api/routes/getInnerIPFSContent/index.js @@ -15,13 +15,14 @@ function fetchZblock(zblock, res){ }; module.exports = (req, res) => { console.log(req.query) - if ( (req.query.ipfs) && req.query.ipfs.length === 46 ){ + if ( (req.query.ipfs) && typeof req.query.ipfs === "string" && req.query.ipfs.length === 46 ){ + let ipfs = req.query.ipfs; regex= /Qm[A-Za-z0-9]{44}/; - if (regex.test(req.query.ipfs)){ - if (req.query.ipfs === "QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" ){ + if (regex.test(ipfs)){ + if (ipfs === "QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" ){ res.send({error:"Genesis block"}); } else { - fetchZblock(req.query.ipfs,res); + fetchZblock(ipfs,res); } } else { res.send({error:"Invalid data: regexp failed to pass"}); |