mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 20:13:51 +01:00
Avoid raising errors due to malformed IDs in get_current_hosts_in_room
(#13748)
Handle malformed user IDs with no colons in `get_current_hosts_in_room`. It's not currently possible for a malformed user ID to join a room, so this error would never be hit. Signed-off-by: Sean Quah <seanq@matrix.org>
This commit is contained in:
parent
8ef0c8ff14
commit
89e8b98b65
2 changed files with 5 additions and 1 deletions
1
changelog.d/13748.misc
Normal file
1
changelog.d/13748.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Avoid raising an error due to malformed user IDs in `get_current_hosts_in_room`. Malformed user IDs cannot currently join a room, so this error would not be hit.
|
|
@ -1044,6 +1044,8 @@ class RoomMemberWorkerStore(EventsWorkerStore):
|
||||||
# We use a `Set` just for fast lookups
|
# We use a `Set` just for fast lookups
|
||||||
domain_set: Set[str] = set()
|
domain_set: Set[str] = set()
|
||||||
for u in users:
|
for u in users:
|
||||||
|
if ":" not in u:
|
||||||
|
continue
|
||||||
domain = get_domain_from_id(u)
|
domain = get_domain_from_id(u)
|
||||||
if domain not in domain_set:
|
if domain not in domain_set:
|
||||||
domain_set.add(domain)
|
domain_set.add(domain)
|
||||||
|
@ -1077,7 +1079,8 @@ class RoomMemberWorkerStore(EventsWorkerStore):
|
||||||
ORDER BY min(e.depth) ASC;
|
ORDER BY min(e.depth) ASC;
|
||||||
"""
|
"""
|
||||||
txn.execute(sql, (room_id,))
|
txn.execute(sql, (room_id,))
|
||||||
return [d for d, in txn]
|
# `server_domain` will be `NULL` for malformed MXIDs with no colons.
|
||||||
|
return [d for d, in txn if d is not None]
|
||||||
|
|
||||||
return await self.db_pool.runInteraction(
|
return await self.db_pool.runInteraction(
|
||||||
"get_current_hosts_in_room", get_current_hosts_in_room_txn
|
"get_current_hosts_in_room", get_current_hosts_in_room_txn
|
||||||
|
|
Loading…
Reference in a new issue