Skip to content

Commit

Permalink
Fix logging errors when receiving invalid User ID for key querys (ele…
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored and Mic92 committed Jun 14, 2024
1 parent 23f4e16 commit 8020f13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/17250.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop logging errors when receiving invalid User IDs in key querys requests.
5 changes: 5 additions & 0 deletions synapse/handlers/e2e_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ async def query_devices(
remote_queries = {}

for user_id, device_ids in device_keys_query.items():
if not UserID.is_valid(user_id):
# Ignore invalid user IDs, which is the same behaviour as if
# the user existed but had no keys.
continue

# we use UserID.from_string to catch invalid user ids
if self.is_mine(UserID.from_string(user_id)):
local_query[user_id] = device_ids
Expand Down

0 comments on commit 8020f13

Please sign in to comment.