mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-13 10:35:41 -04:00
fix(sdk): add more invalid characters for room aliases
This commit is contained in:
committed by
Jorge Martin Espinosa
parent
7c600fddf0
commit
46232ee2c1
@@ -66,7 +66,7 @@ pub enum RoomDisplayName {
|
||||
}
|
||||
|
||||
const WHITESPACE_REGEX: &str = r"\s+";
|
||||
const INVALID_SYMBOLS_REGEX: &str = r"[#,:]+";
|
||||
const INVALID_SYMBOLS_REGEX: &str = r"[#,:\{\}\\]+";
|
||||
|
||||
impl RoomDisplayName {
|
||||
/// Transforms the current display name into the name part of a
|
||||
@@ -636,7 +636,7 @@ mod tests {
|
||||
fn test_room_alias_from_room_display_name_removes_invalid_ascii_symbols() {
|
||||
assert_eq!(
|
||||
"roomalias",
|
||||
RoomDisplayName::Named("#Room,Alias:".to_owned()).to_room_alias_name()
|
||||
RoomDisplayName::Named("#Room,{Alias}:".to_owned()).to_room_alias_name()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ impl IntoRawStateEventContent for &Box<RawJsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
const INVALID_ROOM_ALIAS_NAME_CHARS: &str = "#,:";
|
||||
const INVALID_ROOM_ALIAS_NAME_CHARS: &str = "#,:{}\\";
|
||||
|
||||
/// Verifies the passed `String` matches the expected room alias format:
|
||||
///
|
||||
@@ -265,7 +265,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_is_room_alias_format_valid_when_name_part_has_invalid_char_is_not_valid() {
|
||||
assert!(!is_room_alias_format_valid("#alias,test:domain.org".to_owned()))
|
||||
assert!(!is_room_alias_format_valid("#a#lias,{t\\est}:domain.org".to_owned()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user