diff options
author | Erik Johnston <erik@matrix.org> | 2016-06-14 13:25:29 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-06-14 13:25:29 +0100 |
commit | 36e2aade8790f3f2d86e8f6cc8a6de21e8bec4fa (patch) | |
tree | 5b92516215687b25d9c3d35a9c1c96a47352e9ce | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-36e2aade8790f3f2d86e8f6cc8a6de21e8bec4fa.tar.xz |
Make get_domain_from_id throw SynapseError on invalid ID
-rw-r--r-- | synapse/types.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/types.py b/synapse/types.py index 7b6ae44bdd..f639651a73 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -22,7 +22,10 @@ Requester = namedtuple("Requester", ["user", "access_token_id", "is_guest"]) def get_domain_from_id(string): - return string.split(":", 1)[1] + try: + return string.split(":", 1)[1] + except IndexError: + raise SynapseError(400, "Invalid ID: %r", string) class DomainSpecificString( |