mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
id: make user id parsing more efficient
Some checks failed
Some checks failed
This commit is contained in:
parent
0fcb552c27
commit
826089e020
1 changed files with 4 additions and 4 deletions
|
|
@ -43,10 +43,10 @@ func ParseCommonIdentifier[Stringish ~string](identifier Stringish) (sigil byte,
|
|||
}
|
||||
sigil = identifier[0]
|
||||
strIdentifier := string(identifier)
|
||||
if strings.ContainsRune(strIdentifier, ':') {
|
||||
parts := strings.SplitN(strIdentifier, ":", 2)
|
||||
localpart = parts[0][1:]
|
||||
homeserver = parts[1]
|
||||
colonIdx := strings.IndexByte(strIdentifier, ':')
|
||||
if colonIdx > 0 {
|
||||
localpart = strIdentifier[1:colonIdx]
|
||||
homeserver = strIdentifier[colonIdx+1:]
|
||||
} else {
|
||||
localpart = strIdentifier[1:]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue