From 9802de23cec07ca466dc15f769f42d81613b1124 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 27 Sep 2021 12:05:16 +0200 Subject: [PATCH] Fix getTurnServer response: integer ttl `ttl` must be an integer according to the OpenAPI spec: https://github.com/matrix-org/matrix-doc/blob/old_master/data/api/client-server/voip.yaml#L70 True division (`/`) returns a float instead (`"ttl": 7200.0`). Floor division (`//`) returns an integer, so the response is spec compliant. Signed-off-by: Lukas Lihotzki --- changelog.d/10922.bugfix | 1 + synapse/rest/client/voip.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/10922.bugfix diff --git a/changelog.d/10922.bugfix b/changelog.d/10922.bugfix new file mode 100644 index 000000000000..b7315514e0e7 --- /dev/null +++ b/changelog.d/10922.bugfix @@ -0,0 +1 @@ +Fix a minor bug in the response to `/_matrix/client/r0/voip/turnServer`. Contributed by @lukaslihotzki. diff --git a/synapse/rest/client/voip.py b/synapse/rest/client/voip.py index ea2b8aa45f4e..ea7e025156da 100644 --- a/synapse/rest/client/voip.py +++ b/synapse/rest/client/voip.py @@ -70,7 +70,7 @@ async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: { "username": username, "password": password, - "ttl": userLifetime / 1000, + "ttl": userLifetime // 1000, "uris": turnUris, }, )