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

Commit 04693e5

Browse files
clokephughns
authored andcommitted
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.
1 parent 9c3f1c7 commit 04693e5

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

changelog.d/16185.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a spec compliance issue where requests to the `/publicRooms` federation API would specify `include_all_networks` as a string.

synapse/federation/transport/client.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,11 @@ async def get_public_rooms(
475475
See synapse.federation.federation_client.FederationClient.get_public_rooms for
476476
more information.
477477
"""
478+
path = _create_v1_path("/publicRooms")
479+
478480
if search_filter:
479481
# this uses MSC2197 (Search Filtering over Federation)
480-
path = _create_v1_path("/publicRooms")
481-
482-
data: Dict[str, Any] = {
483-
"include_all_networks": "true" if include_all_networks else "false"
484-
}
482+
data: Dict[str, Any] = {"include_all_networks": include_all_networks}
485483
if third_party_instance_id:
486484
data["third_party_instance_id"] = third_party_instance_id
487485
if limit:
@@ -505,17 +503,15 @@ async def get_public_rooms(
505503
)
506504
raise
507505
else:
508-
path = _create_v1_path("/publicRooms")
509-
510506
args: Dict[str, Union[str, Iterable[str]]] = {
511507
"include_all_networks": "true" if include_all_networks else "false"
512508
}
513509
if third_party_instance_id:
514-
args["third_party_instance_id"] = (third_party_instance_id,)
510+
args["third_party_instance_id"] = third_party_instance_id
515511
if limit:
516-
args["limit"] = [str(limit)]
512+
args["limit"] = str(limit)
517513
if since_token:
518-
args["since"] = [since_token]
514+
args["since"] = since_token
519515

520516
try:
521517
response = await self.client.get_json(

0 commit comments

Comments
 (0)