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