server from uid weak patch
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-26 15:23:24 +01:00
parent 1398c6040a
commit 0070a64d5f

View File

@ -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
}