diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/directory.go b/src/github.com/matrix-org/dendrite/clientapi/routing/directory.go index d5df2dd2d..e7f4ef2a6 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/directory.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/directory.go @@ -116,14 +116,12 @@ func SetLocalAlias( // Check that the alias does not fall within an exclusive namespace of an // application service for _, appservice := range cfg.Derived.ApplicationServices { - for key, namespaceMaps := range appservice.NamespaceMap { - if key == "aliases" { - for _, namespace := range namespaceMaps { - if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) { - return util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.ASExclusive("Alias is reserved by an application service"), - } + if userNamespaces, ok := appservice.NamespaceMap["users"]; ok { + for _, namespace := range userNamespaces { + if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) { + return util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: jsonerror.ASExclusive("Alias is reserved by an application service"), } } }