fix issue when mentioning room with invalid canonical aliases

This commit is contained in:
Henry Hiles 2026-11-24 12:57:19 -05:00
commit b0d22e5570
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -1,5 +1,5 @@
extension GetLocalpart on String {
String get localpart => length > 1 ? substring(1).split(":").first : "?";
String? get localpart => length > 1 ? substring(1).split(":").first : null;
/// Whether this looks like a valid Matrix user ID, e.g. `@user:example.com`.
bool get isValidUserId => RegExp(r"^@[^:\s]+:[^\s]+$").hasMatch(this);