diff --git a/internal/matrix/user_id.go b/internal/matrix/user_id.go index 307ec37..6cb498e 100644 --- a/internal/matrix/user_id.go +++ b/internal/matrix/user_id.go @@ -1,12 +1,21 @@ package matrix -import "maunium.net/go/mautrix/id" +import ( + "net/url" + + "maunium.net/go/mautrix/id" +) func makeUserID(userIdentifier, homeserverURL string) (id.UserID, error) { userID := id.UserID(userIdentifier) localpart, _, err := userID.Parse() if err != nil { - userID = id.NewUserID(userIdentifier, homeserverURL) + url, err := url.Parse(homeserverURL) + if err != nil { + return "", err + } + + userID = id.NewUserID(userIdentifier, url.Host) if _, _, err := userID.ParseAndValidate(); err != nil { return "", err }