Fix a 500 error resulting from empty room_ids

POST /_matrix/client/api/v1/rooms//send/a.b.c gave a 500 error, because we
assumed that rooms always had at least one character.
This commit is contained in:
Richard van der Hoff 2015-10-26 18:32:49 +00:00
parent 3f0a57eb9b
commit f69a5c9134
2 changed files with 8 additions and 3 deletions

View file

@ -47,7 +47,7 @@ class DomainSpecificString(
@classmethod
def from_string(cls, s):
"""Parse the string given by 's' into a structure object."""
if s[0] != cls.SIGIL:
if len(s) < 1 or s[0] != cls.SIGIL:
raise SynapseError(400, "Expected %s string to start with '%s'" % (
cls.__name__, cls.SIGIL,
))