Skip to content

Commit debb8ef

Browse files
committed
fix: EC - unable to upgrade if version label has special characters
1 parent af9100c commit debb8ef

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pkg/embeddedcluster/upgrade.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"log"
1111
"net/http"
12+
"net/url"
1213
"os"
1314
"os/exec"
1415
"path/filepath"
@@ -219,7 +220,7 @@ func downloadUpgradeBinary(ctx context.Context, license kotsv1beta1.License, ver
219220
}
220221

221222
func newDownloadUpgradeBinaryRequest(ctx context.Context, license kotsv1beta1.License, versionLabel string) (*http.Request, error) {
222-
url := fmt.Sprintf("%s/clusterconfig/artifact/operator?versionLabel=%s", license.Spec.Endpoint, versionLabel)
223+
url := fmt.Sprintf("%s/clusterconfig/artifact/operator?versionLabel=%s", license.Spec.Endpoint, url.QueryEscape(versionLabel))
223224
req, err := util.NewRequest(http.MethodGet, url, nil)
224225
if err != nil {
225226
return nil, fmt.Errorf("new request: %w", err)

pkg/replicatedapp/embeddedcluster.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10+
"net/url"
1011
"os"
1112

1213
"github.com/pkg/errors"
@@ -15,7 +16,7 @@ import (
1516
)
1617

1718
func GetECVersionForRelease(license *kotsv1beta1.License, versionLabel string) (string, error) {
18-
url := fmt.Sprintf("%s/clusterconfig/version/Installer?versionLabel=%s", license.Spec.Endpoint, versionLabel)
19+
url := fmt.Sprintf("%s/clusterconfig/version/Installer?versionLabel=%s", license.Spec.Endpoint, url.QueryEscape(versionLabel))
1920
req, err := util.NewRequest("GET", url, nil)
2021
if err != nil {
2122
return "", errors.Wrap(err, "failed to call newrequest")
@@ -49,7 +50,7 @@ func GetECVersionForRelease(license *kotsv1beta1.License, versionLabel string) (
4950
}
5051

5152
func DownloadKOTSBinary(license *kotsv1beta1.License, versionLabel string) (string, error) {
52-
url := fmt.Sprintf("%s/clusterconfig/artifact/kots?versionLabel=%s", license.Spec.Endpoint, versionLabel)
53+
url := fmt.Sprintf("%s/clusterconfig/artifact/kots?versionLabel=%s", license.Spec.Endpoint, url.QueryEscape(versionLabel))
5354
req, err := util.NewRequest("GET", url, nil)
5455
if err != nil {
5556
return "", errors.Wrap(err, "failed to call newrequest")

0 commit comments

Comments
 (0)