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

Send proper JSON POST data to /publicRooms #16185

Merged
merged 5 commits into from Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions 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.
16 changes: 6 additions & 10 deletions synapse/federation/transport/client.py
Expand Up @@ -475,13 +475,11 @@ async def get_public_rooms(
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:
Expand All @@ -505,17 +503,15 @@ async def get_public_rooms(
)
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(
Expand Down