Skip to content

Commit

Permalink
Fix logging errors when receiving invalid User ID for key querys (#17250
Browse files Browse the repository at this point in the history
)
  • Loading branch information
erikjohnston authored May 31, 2024
1 parent 7dd14fa commit 64f5a4a
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 64f5a4a

Please sign in to comment.