refactor: Allow room ids to not have a domain

This commit is contained in:
Christian Kußowski 2025-07-17 10:01:49 +02:00
parent 199573634f
commit 0e7e9a9634
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 4 additions and 3 deletions

View File

@ -33,11 +33,12 @@ extension MatrixIdExtension on String {
bool get isValidMatrixId {
if (isEmpty) return false;
if (length > maxLength) return false;
if (!validSigils.contains(substring(0, 1))) {
final sigil = substring(0, 1);
if (!validSigils.contains(sigil)) {
return false;
}
// event IDs do not have to have a domain
if (substring(0, 1) == '\$') {
// event IDs and room IDs do not have to have a domain
if ({'\$', '!'}.contains(sigil)) {
return true;
}
// all other matrix IDs have to have a domain