diff --git a/internal/config/helm_test.go b/internal/config/helm_test.go index 4f08a2b5..5020b28a 100644 --- a/internal/config/helm_test.go +++ b/internal/config/helm_test.go @@ -370,11 +370,11 @@ var _ = Describe("Helm tests", Label("helm"), func() { Repositories: []*kubernetes.HelmRepository{ { Name: "apache", - URL: "https://example.com/apache", + URL: "https://example.com/apache/", }, { Name: "nginx", - URL: "oci://example.com/web", + URL: "oci://example.com/web/", }, }, }, @@ -498,7 +498,7 @@ metadata: spec: chart: apache version: 10.7.0 - repo: https://example.com/apache + repo: https://example.com/apache/ valuesContent: | image: debug: true @@ -592,7 +592,7 @@ spec: }, { Name: "nginx", - URL: "oci://example.com/web", + URL: "oci://example.com/web/", // trailing slash }, { Name: "storage", diff --git a/pkg/helm/helm.go b/pkg/helm/helm.go index 3439eda3..69c32f50 100644 --- a/pkg/helm/helm.go +++ b/pkg/helm/helm.go @@ -19,6 +19,7 @@ package helm import ( "fmt" + "net/url" "strings" ) @@ -84,7 +85,7 @@ func NewCRD(namespace, chart, version, valuesContent string, repository string, // The repository is in fact an OCI registry. // Use the full path for the chart identifier and drop the "repository" value. // The latter is only valid for HTTP(s) repositories. - chart = fmt.Sprintf("%s/%s", repository, name) + chart, _ = url.JoinPath(repository, name) repository = "" }