summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-12-07 11:19:43 +0000
committerGitHub <noreply@github.com>2022-12-07 11:19:43 +0000
commitcf1059d045640485a5a0b1e3d945b796b0e6f228 (patch)
treee0e408463d49bcc58865127b354aa826c2a701e6 /synapse/rest
parentFaster remote room joins: unblock tasks waiting for full room state when the ... (diff)
downloadsynapse-cf1059d045640485a5a0b1e3d945b796b0e6f228.tar.xz
Fix a long-standing bug where the user directory would return 1 more row than requested. (#14631)
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/user_directory.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/rest/client/user_directory.py b/synapse/rest/client/user_directory.py
index 116c982ce6..4670fad608 100644
--- a/synapse/rest/client/user_directory.py
+++ b/synapse/rest/client/user_directory.py
@@ -63,8 +63,8 @@ class UserDirectorySearchRestServlet(RestServlet):
 
         body = parse_json_object_from_request(request)
 
-        limit = body.get("limit", 10)
-        limit = min(limit, 50)
+        limit = int(body.get("limit", 10))
+        limit = max(min(limit, 50), 0)
 
         try:
             search_term = body["search_term"]