From 81d1f35bdce6da2c102471d5fe705f9e428159a2 Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Tue, 16 Aug 2022 10:36:12 +1200 Subject: [PATCH] fix snapshot url parsing issue for ip addresses (#7478) --- api/agent/version.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/agent/version.go b/api/agent/version.go index 92926cf93..0c42022ad 100644 --- a/api/agent/version.go +++ b/api/agent/version.go @@ -7,6 +7,7 @@ import ( "net/http" netUrl "net/url" "strconv" + "strings" "time" 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)) if err != nil { return 0, "", err