From f7c79e94da449ecd0c93a524cf7b61ef5eb88b22 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 8 Jun 2022 14:45:34 -0400 Subject: [PATCH 1/2] Stop depending on the room_id to be returned for children state. --- synapse/federation/federation_client.py | 4 ---- tests/handlers/test_room_summary.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index ad475a913b54..66e6305562f5 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -1642,10 +1642,6 @@ def _validate_hierarchy_event(d: JsonDict) -> None: if not isinstance(event_type, str): raise ValueError("Invalid event: 'event_type' must be a str") - room_id = d.get("room_id") - if not isinstance(room_id, str): - raise ValueError("Invalid event: 'room_id' must be a str") - state_key = d.get("state_key") if not isinstance(state_key, str): raise ValueError("Invalid event: 'state_key' must be a str") diff --git a/tests/handlers/test_room_summary.py b/tests/handlers/test_room_summary.py index 0546655690fd..aa650756e40b 100644 --- a/tests/handlers/test_room_summary.py +++ b/tests/handlers/test_room_summary.py @@ -178,7 +178,7 @@ def _assert_hierarchy( result_room_ids.append(result_room["room_id"]) result_children_ids.append( [ - (cs["room_id"], cs["state_key"]) + (result_room["room_id"], cs["state_key"]) for cs in result_room["children_state"] ] ) From 77cacc275ff19f84a7990cdcc219a8a6b7e42fe4 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 8 Jun 2022 14:50:26 -0400 Subject: [PATCH 2/2] Newsfragment --- changelog.d/12991.bugfix | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/12991.bugfix diff --git a/changelog.d/12991.bugfix b/changelog.d/12991.bugfix new file mode 100644 index 000000000000..c6e388d5b976 --- /dev/null +++ b/changelog.d/12991.bugfix @@ -0,0 +1,2 @@ +Fix a bug where non-standard information was required when requesting the `/hierarchy` API over federation. Introduced +in Synapse v1.41.0.