summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-04-09 12:56:22 +0100
committerRichard van der Hoff <richard@matrix.org>2018-04-09 12:56:22 +0100
commitf3ef60662fd32672f980e3c6e31aa1b25e8ed808 (patch)
treef58ba42c1ef10f7294bc3536b3c07c7ff2b29170 /synapse
parentmore verbosity in synctl (diff)
downloadsynapse-f3ef60662fd32672f980e3c6e31aa1b25e8ed808.tar.xz
Return a 404 rather than a 500 on rejoining empty rooms
Filter ourselves out of the server list before checking for an empty remote
host list, to fix 500 error

Fixes #2141
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room_member.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 9977be8831..c45142d38d 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -852,6 +852,14 @@ class RoomMemberMasterHandler(RoomMemberHandler):
     def _remote_join(self, requester, remote_room_hosts, room_id, user, content):
         """Implements RoomMemberHandler._remote_join
         """
+        # filter ourselves out of remote_room_hosts: do_invite_join ignores it
+        # and if it is the only entry we'd like to return a 404 rather than a
+        # 500.
+
+        remote_room_hosts = [
+            host for host in remote_room_hosts if host != self.hs.hostname
+        ]
+
         if len(remote_room_hosts) == 0:
             raise SynapseError(404, "No known servers")