Skip to content

Commit

Permalink
Fix backend data validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nkalupahana committed Apr 23, 2024
1 parent 2c82fbd commit fb54ab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const moodLog = async (req: UserRequest, res: Response) => {

data.editTimestamp = data.editTimestamp ? Number(data.editTimestamp) : null;
if (data.editTimestamp) {
if (typeof data.mood !== "number" || isNaN(data.mood) || data.editTimestamp !== parseInt(data.editTimestamp) || data.editTimestamp < 0) {
if (typeof data.editTimestamp !== "number" || isNaN(data.editTimestamp) || data.editTimestamp !== parseInt(data.editTimestamp) || data.editTimestamp < 0) {
res.send(400);
return;
}
Expand Down

0 comments on commit fb54ab8

Please sign in to comment.