mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Directly access namespace map instead of searching for key
This commit is contained in:
parent
1aa6a9d33a
commit
63ec8a4884
|
|
@ -116,14 +116,12 @@ func SetLocalAlias(
|
||||||
// Check that the alias does not fall within an exclusive namespace of an
|
// Check that the alias does not fall within an exclusive namespace of an
|
||||||
// application service
|
// application service
|
||||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||||
for key, namespaceMaps := range appservice.NamespaceMap {
|
if userNamespaces, ok := appservice.NamespaceMap["users"]; ok {
|
||||||
if key == "aliases" {
|
for _, namespace := range userNamespaces {
|
||||||
for _, namespace := range namespaceMaps {
|
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
||||||
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
return util.JSONResponse{
|
||||||
return util.JSONResponse{
|
Code: http.StatusBadRequest,
|
||||||
Code: http.StatusBadRequest,
|
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
||||||
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue