diff options
author | Erik Johnston <erikj@jki.re> | 2016-06-14 15:09:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-14 15:09:07 +0100 |
commit | d12134ce37cb66cacd31886bc4bc0eeae954abe0 (patch) | |
tree | a1c24ccfcd7afd9b292930b1eaba959ea01c6920 | |
parent | Merge pull request #866 from bartekrutkowski/develop (diff) | |
parent | Make get_domain_from_id throw SynapseError on invalid ID (diff) | |
download | synapse-d12134ce37cb66cacd31886bc4bc0eeae954abe0.tar.xz |
Merge pull request #868 from matrix-org/erikj/invalid_id
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( |