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

Commit

Permalink
Send proper JSON POST data to /publicRooms (#16185)
Browse files Browse the repository at this point in the history
The include_all_networks was previously sent in the JSON body as
string "true" and "false" instead of boolean true and false.
  • Loading branch information
clokep committed Aug 25, 2023
1 parent a8a46b1 commit fcf7a57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
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

0 comments on commit fcf7a57

Please sign in to comment.