summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-08-01 16:34:32 +0100
committerGitHub <noreply@github.com>2018-08-01 16:34:32 +0100
commitb8d7d3996b748d599b5f2ffe700ee381de5b61eb (patch)
treeff0d789d9d2c279a126c82c35dff32e5104a93fd
parentPython 3: Convert some unicode/bytes uses (#3569) (diff)
parentUpdate 2952.bugfix (diff)
downloadsynapse-b8d7d3996b748d599b5f2ffe700ee381de5b61eb.tar.xz
Merge pull request #3620 from fuzzmz/return-404-room-not-found
return 404 if room not found
-rw-r--r--AUTHORS.rst5
-rw-r--r--changelog.d/2952.bugfix1
-rw-r--r--synapse/rest/client/v1/directory.py4
3 files changed, 7 insertions, 3 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst
index e13ac5ad34..9a83d90153 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -62,4 +62,7 @@ Christoph Witzany <christoph at web.crofting.com>
  * Add LDAP support for authentication
 
 Pierre Jaury <pierre at jaury.eu>
-* Docker packaging
\ No newline at end of file
+* Docker packaging
+
+Serban Constantin <serban.constantin at gmail dot com>
+ * Small bug fix
\ No newline at end of file
diff --git a/changelog.d/2952.bugfix b/changelog.d/2952.bugfix
new file mode 100644
index 0000000000..07a3e48304
--- /dev/null
+++ b/changelog.d/2952.bugfix
@@ -0,0 +1 @@
+Make /directory/list API return 404 for room not found instead of 400
diff --git a/synapse/rest/client/v1/directory.py b/synapse/rest/client/v1/directory.py
index 69dcd618cb..97733f3026 100644
--- a/synapse/rest/client/v1/directory.py
+++ b/synapse/rest/client/v1/directory.py
@@ -18,7 +18,7 @@ import logging
 
 from twisted.internet import defer
 
-from synapse.api.errors import AuthError, Codes, SynapseError
+from synapse.api.errors import AuthError, Codes, NotFoundError, SynapseError
 from synapse.http.servlet import parse_json_object_from_request
 from synapse.types import RoomAlias
 
@@ -159,7 +159,7 @@ class ClientDirectoryListServer(ClientV1RestServlet):
     def on_GET(self, request, room_id):
         room = yield self.store.get_room(room_id)
         if room is None:
-            raise SynapseError(400, "Unknown room")
+            raise NotFoundError("Unknown room")
 
         defer.returnValue((200, {
             "visibility": "public" if room["is_public"] else "private"