summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-04-27 09:20:26 +0100
committerGitHub <noreply@github.com>2017-04-27 09:20:26 +0100
commitd3c150411c7cf694f0a094069d2202e2618d41e1 (patch)
tree94f8f33baddac5b6da915e57a52b7084472675fc /synapse/rest
parentMerge pull request #2160 from matrix-org/erikj/reduce_join_cache_size (diff)
parentCheck that requested room_id exists (diff)
downloadsynapse-d3c150411c7cf694f0a094069d2202e2618d41e1.tar.xz
Merge pull request #2130 from APwhitehat/roomexists
Check that requested room_id exists
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/directory.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/directory.py b/synapse/rest/client/v1/directory.py
index 8930f1826f..f15aa5c13f 100644
--- a/synapse/rest/client/v1/directory.py
+++ b/synapse/rest/client/v1/directory.py
@@ -39,6 +39,7 @@ class ClientDirectoryServer(ClientV1RestServlet):
 
     def __init__(self, hs):
         super(ClientDirectoryServer, self).__init__(hs)
+        self.store = hs.get_datastore()
         self.handlers = hs.get_handlers()
 
     @defer.inlineCallbacks
@@ -70,7 +71,10 @@ class ClientDirectoryServer(ClientV1RestServlet):
         logger.debug("Got servers: %s", servers)
 
         # TODO(erikj): Check types.
-        # TODO(erikj): Check that room exists
+
+        room = yield self.store.get_room(room_id)
+        if room is None:
+            raise SynapseError(400, "Room does not exist")
 
         dir_handler = self.handlers.directory_handler