diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2023-08-25 12:11:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 12:11:40 -0400 |
commit | fcf7a5759efd9bd81838baf298e80e79218f3bf0 (patch) | |
tree | 320d0b4061a48d75b5f63fd2e3af7ee400d1d8ab | |
parent | Replace simple_async_mock with AsyncMock (#16180) (diff) | |
download | synapse-fcf7a5759efd9bd81838baf298e80e79218f3bf0.tar.xz |
Send proper JSON POST data to /publicRooms (#16185)
The include_all_networks was previously sent in the JSON body as string "true" and "false" instead of boolean true and false.
-rw-r--r-- | changelog.d/16185.bugfix | 1 | ||||
-rw-r--r-- | synapse/federation/transport/client.py | 16 |
2 files changed, 7 insertions, 10 deletions
diff --git a/changelog.d/16185.bugfix b/changelog.d/16185.bugfix new file mode 100644 index 0000000000..e62c9c7a0d --- /dev/null +++ b/changelog.d/16185.bugfix @@ -0,0 +1 @@ +Fix a spec compliance issue where requests to the `/publicRooms` federation API would specify `include_all_networks` as a string. diff --git a/synapse/federation/transport/client.py b/synapse/federation/transport/client.py index 0b17f713ea..5ce3f345cb 100644 --- a/synapse/federation/transport/client.py +++ b/synapse/federation/transport/client.py @@ -475,13 +475,11 @@ class TransportLayerClient: See synapse.federation.federation_client.FederationClient.get_public_rooms for more information. """ + path = _create_v1_path("/publicRooms") + if search_filter: # this uses MSC2197 (Search Filtering over Federation) - path = _create_v1_path("/publicRooms") - - data: Dict[str, Any] = { - "include_all_networks": "true" if include_all_networks else "false" - } + data: Dict[str, Any] = {"include_all_networks": include_all_networks} if third_party_instance_id: data["third_party_instance_id"] = third_party_instance_id if limit: @@ -505,17 +503,15 @@ class TransportLayerClient: ) raise else: - path = _create_v1_path("/publicRooms") - args: Dict[str, Union[str, Iterable[str]]] = { "include_all_networks": "true" if include_all_networks else "false" } if third_party_instance_id: - args["third_party_instance_id"] = (third_party_instance_id,) + args["third_party_instance_id"] = third_party_instance_id if limit: - args["limit"] = [str(limit)] + args["limit"] = str(limit) if since_token: - args["since"] = [since_token] + args["since"] = since_token try: response = await self.client.get_json( |