Skip to content

Commit 09c9e6d

Browse files
erikjohnstonH-Shay
authored andcommitted
Fix logging errors when receiving invalid User ID for key querys (element-hq#17250)
1 parent 4122b5b commit 09c9e6d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog.d/17250.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Stop logging errors when receiving invalid User IDs in key querys requests.

synapse/handlers/e2e_keys.py

+5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ async def query_devices(
149149
remote_queries = {}
150150

151151
for user_id, device_ids in device_keys_query.items():
152+
if not UserID.is_valid(user_id):
153+
# Ignore invalid user IDs, which is the same behaviour as if
154+
# the user existed but had no keys.
155+
continue
156+
152157
# we use UserID.from_string to catch invalid user ids
153158
if self.is_mine(UserID.from_string(user_id)):
154159
local_query[user_id] = device_ids

0 commit comments

Comments
 (0)