Check if user is local before lookin up their profile

This commit is contained in:
Brendan Abolivier 2017-08-03 15:19:00 +01:00
parent aae9d3064b
commit 19c8644044
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -42,14 +42,19 @@ func SendMembership(
return *reqErr return *reqErr
} }
localpart, _, err := gomatrixserverlib.SplitID('@', stateKey) localpart, serverName, err := gomatrixserverlib.SplitID('@', stateKey)
if err != nil { if err != nil {
return httputil.LogThenError(req, err) return httputil.LogThenError(req, err)
} }
profile, err := accountDB.GetProfileByLocalpart(localpart) var profile *authtypes.Profile
if err != nil { if serverName == cfg.Matrix.ServerName {
return httputil.LogThenError(req, err) profile, err = accountDB.GetProfileByLocalpart(localpart)
if err != nil {
return httputil.LogThenError(req, err)
}
} else {
profile = &authtypes.Profile{}
} }
builder := gomatrixserverlib.EventBuilder{ builder := gomatrixserverlib.EventBuilder{