reflax a couple restrictions on custom room IDs and aliases
🙃
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
aef25ea1f7
commit
4aead5de7a
1 changed files with 0 additions and 16 deletions
|
@ -900,20 +900,6 @@ async fn room_alias_check(
|
||||||
ErrorKind::InvalidParam,
|
ErrorKind::InvalidParam,
|
||||||
"Room alias contained spaces which is not a valid room alias.",
|
"Room alias contained spaces which is not a valid room alias.",
|
||||||
));
|
));
|
||||||
} else if room_alias_name.len() > 255 {
|
|
||||||
// there is nothing spec-wise saying to check the limit of this,
|
|
||||||
// however absurdly long room aliases are guaranteed to be unreadable or done
|
|
||||||
// maliciously. there is no reason a room alias should even exceed 100
|
|
||||||
// characters as is. generally in spec, 255 is matrix's fav number
|
|
||||||
return Err(Error::BadRequest(
|
|
||||||
ErrorKind::InvalidParam,
|
|
||||||
"Room alias is excessively long, clients may not be able to handle this. Please shorten it.",
|
|
||||||
));
|
|
||||||
} else if room_alias_name.contains('"') {
|
|
||||||
return Err(Error::BadRequest(
|
|
||||||
ErrorKind::InvalidParam,
|
|
||||||
"Room alias contained `\"` which is not allowed.",
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if room alias is forbidden
|
// check if room alias is forbidden
|
||||||
|
@ -979,8 +965,6 @@ fn custom_room_id_check(custom_room_id: &String) -> Result<OwnedRoomId> {
|
||||||
ErrorKind::InvalidParam,
|
ErrorKind::InvalidParam,
|
||||||
"Custom room ID contained spaces which is not valid.",
|
"Custom room ID contained spaces which is not valid.",
|
||||||
));
|
));
|
||||||
} else if custom_room_id.len() > 255 {
|
|
||||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Custom room ID is too long."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let full_room_id = format!("!{}:{}", custom_room_id, services().globals.config.server_name);
|
let full_room_id = format!("!{}:{}", custom_room_id, services().globals.config.server_name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue