fix: HEAD requests should produce METHOD_NOT_ALLOWED

This commit is contained in:
Timo Kösters 2022-10-15 16:56:08 +02:00
parent 2231a69b4c
commit 7c98ba64aa
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
3 changed files with 15 additions and 16 deletions

View file

@ -87,10 +87,7 @@ pub async fn set_room_visibility_route(
if !services().rooms.metadata.exists(&body.room_id)? {
// Return 404 if the room doesn't exist
return Err(Error::BadRequest(
ErrorKind::NotFound,
"Room not found",
));
return Err(Error::BadRequest(ErrorKind::NotFound, "Room not found"));
}
match &body.visibility {
@ -116,13 +113,9 @@ pub async fn set_room_visibility_route(
pub async fn get_room_visibility_route(
body: Ruma<get_room_visibility::v3::IncomingRequest>,
) -> Result<get_room_visibility::v3::Response> {
if !services().rooms.metadata.exists(&body.room_id)? {
// Return 404 if the room doesn't exist
return Err(Error::BadRequest(
ErrorKind::NotFound,
"Room not found",
));
return Err(Error::BadRequest(ErrorKind::NotFound, "Room not found"));
}
Ok(get_room_visibility::v3::Response {

View file

@ -905,7 +905,7 @@ async fn sync_helper(
let leave_shortstatekey = services()
.rooms
.short
.get_or_create_shortstatekey(&StateEventType::RoomMember, &sender_user.as_str())?;
.get_or_create_shortstatekey(&StateEventType::RoomMember, sender_user.as_str())?;
left_state_ids.insert(leave_shortstatekey, left_event_id);