From 0d42ed73c6393ee2c4c4ebcf67d386bb069a2277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Mej=C3=ADas=20Rodr=C3=ADguez?= Date: Fri, 2 Aug 2019 16:09:54 -0400 Subject: [PATCH] Enhance Portainer URL parsing in Client --- common/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/client.go b/common/client.go index e5b586d..ef64d01 100644 --- a/common/client.go +++ b/common/client.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "net/http" "net/url" + "strings" "time" "github.com/spf13/viper" @@ -282,7 +283,7 @@ func (n *PortainerClient) Clone() (c *PortainerClient, err error) { // Create a new client func NewClient(config ClientConfig) (c *PortainerClient, err error) { - apiUrl, err := url.Parse(config.Url + "/api/") + apiUrl, err := url.Parse(strings.TrimRight(config.Url, "/") + "/api/") if err != nil { return }