fix snapshot url parsing issue for ip addresses (#7478)
parent
36c93c7f57
commit
81d1f35bdc
|
@ -7,6 +7,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
netUrl "net/url"
|
netUrl "net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
portainer "github.com/portainer/portainer/api"
|
portainer "github.com/portainer/portainer/api"
|
||||||
|
@ -26,6 +27,10 @@ func GetAgentVersionAndPlatform(url string, tlsConfig *tls.Config) (portainer.Ag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(url, "://") {
|
||||||
|
url = "https://" + url
|
||||||
|
}
|
||||||
|
|
||||||
parsedURL, err := netUrl.Parse(fmt.Sprintf("%s/ping", url))
|
parsedURL, err := netUrl.Parse(fmt.Sprintf("%s/ping", url))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
|
|
Loading…
Reference in New Issue