summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-04-09 17:32:36 +0100
committerGitHub <noreply@github.com>2018-04-09 17:32:36 +0100
commitd2c6f4d626f6b0edcf272689854cb05b73044c15 (patch)
tree3667c39715e6f65cc2ef3c29fdf55a6e866d25c9
parentRevert "Merge pull request #3066 from matrix-org/rav/remove_redundant_metrics" (diff)
parentReturn a 404 rather than a 500 on rejoining empty rooms (diff)
downloadsynapse-d2c6f4d626f6b0edcf272689854cb05b73044c15.tar.xz
Merge pull request #3080 from matrix-org/rav/fix_500_on_rejoin
Return a 404 rather than a 500 on rejoining empty rooms
-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")