Skip to content

Commit

Permalink
fix: validate message before reading
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Aug 27, 2023
1 parent a866a05 commit 80aa16e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ router.get('/api/messages/:hash', async (req, res) => {
});

router.post('/', async (req, res) => {
const msg = req.body.data.message;

if (!req.body.data || !req.body.data.message) {
return res.status(400).json({
error: 'Invalid format request'
});
}

const msg = req.body.data.message;
if (!req.body.data.types.Space && !msg.settings && !msg.space) {
return res.status(400).json({
error: 'Missing space'
Expand Down

0 comments on commit 80aa16e

Please sign in to comment.