From 0256c2736361f14d4611af7f543430a03d669bc0 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 26 May 2024 16:36:00 -0400 Subject: [PATCH] check if we know about room at /make_leave Signed-off-by: strawberry --- src/api/server_server.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 3a94a60f..95e99cc8 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -1365,6 +1365,10 @@ pub(crate) async fn create_join_event_v2_route( pub(crate) async fn create_leave_event_template_route( body: Ruma, ) -> Result { + if !services().rooms.metadata.exists(&body.room_id)? { + return Err(Error::BadRequest(ErrorKind::NotFound, "Room is unknown to this server.")); + } + let origin = body.origin.as_ref().expect("server is authenticated"); // ACL check origin