Skip to content

Commit

Permalink
Handle invalid report requests properly (#645)
Browse files Browse the repository at this point in the history
Sorry i forgot where I was in
f07b003.
  • Loading branch information
Gnuxie authored Dec 18, 2024
1 parent bd86e73 commit e24bb80
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/webapis/WebAPIs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ export class WebAPIs {
const roomID = request.params.room_id;
const eventID = request.params.event_id;
if (!isStringRoomID(roomID)) {
throw new TypeError(
log.error(
`Invalid roomID provided when processing a report, check your webproxy: ${roomID}`
);
response
.status(400)
.send({ errcode: "M_INVALID_PARAM", error: "Invalid room ID" });
return;
}
if (!isStringEventID(eventID)) {
throw new TypeError(
log.error(
`Invalid eventID provided when processing a report, check your webproxy: ${eventID}`
);
response
.status(400)
.send({ errcode: "M_INVALID_PARAM", error: "Invalid event ID" });
return;
}
void Task(
this.handleReport({
Expand Down

0 comments on commit e24bb80

Please sign in to comment.