diff --git a/internal/build/helm.go b/internal/build/helm.go index d8208e27..35e51db5 100644 --- a/internal/build/helm.go +++ b/internal/build/helm.go @@ -619,7 +619,7 @@ func (h *Helm) buildFromHelmRepository(ctx context.Context, obj *sourcev1beta2.H } ref := chart.RemoteReference{Name: obj.Spec.Chart, Version: obj.Spec.Version} - path, chartCacheKey, err := h.cache.GetOrLock(normalizedURL, ref) + path, chartCacheKey, err := h.cache.GetOrLock(normalizedURL, ref.WithEscapedName()) if err != nil { return err } diff --git a/internal/helm/chart/builder.go b/internal/helm/chart/builder.go index 22eae41a..e77e75bb 100644 --- a/internal/helm/chart/builder.go +++ b/internal/helm/chart/builder.go @@ -19,6 +19,7 @@ package chart import ( "context" "fmt" + "net/url" "os" "path/filepath" "regexp" @@ -75,6 +76,12 @@ type RemoteReference struct { Version string } +// WithEscapedName returns a new RemoteReference with the Name URL-escaped. +func (r RemoteReference) WithEscapedName() RemoteReference { + r.Name = url.PathEscape(r.Name) + return r +} + // Validate returns an error if the RemoteReference does not have // a Name set. func (r RemoteReference) Validate() error {