From 426aa5b615fe0f4d6cba3dad3db7b3dcb52b6ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 13 Nov 2024 09:33:17 +0100 Subject: [PATCH] fixup! fix: Use the DisplayName struct to protect against homoglyph attacks --- crates/matrix-sdk-base/src/store/ambiguity_map.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-base/src/store/ambiguity_map.rs b/crates/matrix-sdk-base/src/store/ambiguity_map.rs index 71679403223..375f176f0e6 100644 --- a/crates/matrix-sdk-base/src/store/ambiguity_map.rs +++ b/crates/matrix-sdk-base/src/store/ambiguity_map.rs @@ -301,10 +301,12 @@ impl AmbiguityCache { .get(display_name) .map(|user_ids| is_display_name_ambiguous(display_name, user_ids)) }) - .expect(&format!( - "The display name {:?} should be part of the cache {:?}", - display_name, self.cache - )) + .unwrap_or_else(|| { + panic!( + "The display name {:?} should be part of the cache {:?}", + display_name, self.cache + ) + }) } }