Skip to content

Commit de441b7

Browse files
committed
BUG/MINOR: construct urls without duplicating slashes
1 parent a6cd451 commit de441b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

configuration/cluster_sync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (c *ClusterSync) monitorCertificateRefresh() {
124124
}
125125

126126
func (c *ClusterSync) issueRefreshRequest(url, port, basePath string, nodesPath string, csr, key string) error {
127-
url = fmt.Sprintf("%s:%s%s/%s/%s", url, port, basePath, nodesPath, c.cfg.Cluster.ID.Load())
127+
url = fmt.Sprintf("%s:%s/%s", url, port, strings.TrimLeft(path.Join(basePath, nodesPath, c.cfg.Cluster.ID.Load()), "/"))
128128
apiAddress := c.cfg.APIOptions.APIAddress
129129
if apiAddress == "" {
130130
apiAddress = c.cfg.RuntimeData.Host
@@ -262,7 +262,7 @@ func (c *ClusterSync) monitorBootstrapKey() {
262262
}
263263

264264
func (c *ClusterSync) issueJoinRequest(url, port, basePath string, registerPath string, csr, key string) error {
265-
url = fmt.Sprintf("%s:%s%s/%s", url, port, basePath, registerPath)
265+
url = fmt.Sprintf("%s:%s/%s", url, port, strings.TrimLeft(path.Join(basePath, registerPath), "/"))
266266
apiCfg := c.cfg.APIOptions
267267
userStore := GetUsersStore()
268268

@@ -480,7 +480,7 @@ func (c *ClusterSync) fetchCert() {
480480
apiBasePath := c.cfg.Cluster.APIBasePath.Load()
481481
apiNodesPath := c.cfg.Cluster.APINodesPath.Load()
482482
id := c.cfg.Cluster.ID.Load()
483-
url = fmt.Sprintf("%s:%s/%s/%s/%s", url, port, apiBasePath, apiNodesPath, id)
483+
url = fmt.Sprintf("%s:%s/%s", url, port, strings.TrimLeft(path.Join(apiBasePath, apiNodesPath, id), "/"))
484484
req, err := http.NewRequest("GET", url, nil)
485485
if err != nil {
486486
c.activateFetchCert(err)

0 commit comments

Comments
 (0)