diff --git a/client/server.go b/client/server.go index 2da7b3f..763bd5b 100644 --- a/client/server.go +++ b/client/server.go @@ -45,11 +45,15 @@ func CreateServerFromUrl(url string) *Server { // CreateServerFromUid creates a server from a uid string, ex : mylogin:mypassword@https://my.meowserver.example:8443/meow/ func CreateServerFromUid(uid string) *Server { var is Server - uidTable := strings.Split(uid, "@") - loginpw := strings.Split(uidTable[0], ":") - is.Url = uidTable[1] - is.Login = loginpw[0] - is.Password = loginpw[1] + uidTable := strings.Split(uid, "@") //! Weak test, use regexp + if len(uidTable) == 2 { + loginpw := strings.Split(uidTable[0], ":") + is.Url = uidTable[1] + is.Login = loginpw[0] + is.Password = loginpw[1] + } else { + is.Url = uidTable[0] + } return &is }