Skip to content

Commit

Permalink
fix: EC - unable to upgrade if version label has special characters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh authored Sep 17, 2024
1 parent 950df53 commit 73a1f73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/embeddedcluster/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"log"
"net/http"
"net/url"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -211,7 +212,7 @@ func downloadUpgradeBinary(ctx context.Context, license kotsv1beta1.License, ver
}

func newDownloadUpgradeBinaryRequest(ctx context.Context, license kotsv1beta1.License, versionLabel string) (*http.Request, error) {
url := fmt.Sprintf("%s/clusterconfig/artifact/operator?versionLabel=%s", license.Spec.Endpoint, versionLabel)
url := fmt.Sprintf("%s/clusterconfig/artifact/operator?versionLabel=%s", license.Spec.Endpoint, url.QueryEscape(versionLabel))
req, err := util.NewRequest(http.MethodGet, url, nil)
if err != nil {
return nil, fmt.Errorf("new request: %w", err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/replicatedapp/embeddedcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"os"

"github.com/pkg/errors"
Expand All @@ -15,7 +16,7 @@ import (
)

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

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

0 comments on commit 73a1f73

Please sign in to comment.