Browse Source

The server can (and does) send the empty string as a room_name, so check for this.

David Baker 8 years ago
parent
commit
f75824814d
1 changed files with 5 additions and 4 deletions
  1. 5 4
      sydent/http/servlets/store_invite_servlet.py

+ 5 - 4
sydent/http/servlets/store_invite_servlet.py

@@ -79,10 +79,6 @@ class StoreInviteServlet(Resource):
                 substitutions[key] = cgi.escape(values[0])
         substitutions["token"] = token
 
-        substitutions["ephemeral_private_key"] = ephemeralPrivateKeyBase64
-        if "room_name" in substitutions:
-            substitutions["bracketed_room_name"] = "(%s)" % substitutions["room_name"]
-
         required = [
             'sender_display_name',
             'token',
@@ -94,6 +90,11 @@ class StoreInviteServlet(Resource):
         for k in required:
             substitutions.setdefault(k, '')
 
+        substitutions["ephemeral_private_key"] = ephemeralPrivateKeyBase64
+        if substitutions["room_name"] != '':
+            substitutions["bracketed_room_name"] = "(%s)" % substitutions["room_name"]
+
+
         sendEmail(self.sydent, "email.invite_template", address, substitutions)
 
         pubKey = self.sydent.keyring.ed25519.verify_key