Skip to content

Commit

Permalink
fix: return a 400 error on invalid address
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Aug 27, 2023
1 parent de71f4b commit 32a0206
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ router.post('/', async (req, res) => {
});
}

let address;
try {
address = getAddress(req.body.address);
} catch (e: any) {
return res.status(400).json({
error: 'Invalid address'
});
}

try {
const msg = req.body.data.message;
const msgHash = snapshot.utils.getHash(req.body.data);
const address = getAddress(req.body.address);
const env = 'livenet';
let network = env === 'livenet' ? '1' : '5';
if (!req.body.data.types.Space && !msg.settings)
Expand Down

0 comments on commit 32a0206

Please sign in to comment.