Fix logging errors when receiving invalid User ID for key querys (#17250)

This commit is contained in:
Erik Johnston 2024-05-31 11:27:56 +01:00 committed by GitHub
parent 7dd14fadb1
commit 64f5a4a353
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

1
changelog.d/17250.misc Normal file
View File

@ -0,0 +1 @@
Stop logging errors when receiving invalid User IDs in key querys requests.

View File

@ -149,6 +149,11 @@ class E2eKeysHandler:
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