Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/config/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
},
},
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -592,7 +592,7 @@ spec:
},
{
Name: "nginx",
URL: "oci://example.com/web",
URL: "oci://example.com/web/", // trailing slash
},
{
Name: "storage",
Expand Down
3 changes: 2 additions & 1 deletion pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package helm

import (
"fmt"
"net/url"
"strings"
)

Expand Down Expand Up @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this isn't silencing URL typos or similar errors. Isn't chart set to empty string on errors?

At this stage it is not clear to me if input values have been already sanitized.

repository = ""
}

Expand Down