From 0070a64d5ff982968ca4267902ce9c95bf320fac Mon Sep 17 00:00:00 2001 From: ycc Date: Tue, 26 Mar 2024 15:23:24 +0100 Subject: [PATCH] server from uid weak patch --- client/server.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 }