Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 1e2be28

Browse files
committed
Make sure prev_ids defaults to empty list
While this change seems a bit strange, I was seeing TypeErrors on my homeserver because someone is sending device lists where they explicitly set `"prev_id": null` which causes the next list comprehension to fail. Signed-off-by: Carl Bordum Hansen <[email protected]>
1 parent 39dee30 commit 1e2be28

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

changelog.d/12829.bugfix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed a bug where device list updates over federation would fail if they
2+
explicitly set `prev_id` to `null`. Contributed by Carl Bordum Hansen.

synapse/handlers/device.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ async def incoming_device_list_update(
762762
user_id = edu_content.pop("user_id")
763763
device_id = edu_content.pop("device_id")
764764
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
765-
prev_ids = edu_content.pop("prev_id", [])
765+
prev_ids = edu_content.pop("prev_id") or []
766766
prev_ids = [str(p) for p in prev_ids] # They may come as ints
767767

768768
if get_domain_from_id(user_id) != origin:

0 commit comments

Comments
 (0)