mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-19 08:24:25 +01:00
Merge pull request #2226 from matrix-org/erikj/domain_from_id
Speed up get_domain_from_id
This commit is contained in:
commit
11bc21b6d9
1 changed files with 3 additions and 3 deletions
|
@ -56,10 +56,10 @@ def create_requester(user_id, access_token_id=None, is_guest=False,
|
||||||
|
|
||||||
|
|
||||||
def get_domain_from_id(string):
|
def get_domain_from_id(string):
|
||||||
try:
|
idx = string.find(":")
|
||||||
return string.split(":", 1)[1]
|
if idx == -1:
|
||||||
except IndexError:
|
|
||||||
raise SynapseError(400, "Invalid ID: %r" % (string,))
|
raise SynapseError(400, "Invalid ID: %r" % (string,))
|
||||||
|
return string[idx + 1:]
|
||||||
|
|
||||||
|
|
||||||
class DomainSpecificString(
|
class DomainSpecificString(
|
||||||
|
|
Loading…
Reference in a new issue