diff options
author | Erik Johnston <erikj@jki.re> | 2017-05-16 17:18:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-16 17:18:16 +0100 |
commit | 11bc21b6d9a46e8bb4ca1ecf9b45dd78548adb8b (patch) | |
tree | 4de2f21de5d74d99d5875cf87ffd09000647da69 /synapse | |
parent | Merge pull request #2224 from matrix-org/erikj/prefill_state (diff) | |
parent | Speed up get_domain_from_id (diff) | |
download | synapse-11bc21b6d9a46e8bb4ca1ecf9b45dd78548adb8b.tar.xz |
Merge pull request #2226 from matrix-org/erikj/domain_from_id
Speed up get_domain_from_id
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/types.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/types.py b/synapse/types.py index c87ed813b9..445bdcb4d7 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -56,10 +56,10 @@ def create_requester(user_id, access_token_id=None, is_guest=False, def get_domain_from_id(string): - try: - return string.split(":", 1)[1] - except IndexError: + idx = string.find(":") + if idx == -1: raise SynapseError(400, "Invalid ID: %r" % (string,)) + return string[idx + 1:] class DomainSpecificString( |