From 3a1861853772a41ccaa876c2c97b35a081142dea Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Wed, 1 Oct 2025 16:13:15 +0200 Subject: [PATCH] Avoid misleading user with ref.Tag with version dash as underscore on er Before ``` Error: tag "0.2.0_meta" does not match provided chart version "0.1.0+meta" ``` After ``` Error: tag "0.2.0+meta" does not match provided chart version "0.1.0+meta" ``` Signed-off-by: Benoit Tigeot --- pkg/registry/pushref.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/registry/pushref.go b/pkg/registry/pushref.go index 33c801d1a..eaa85d60b 100644 --- a/pkg/registry/pushref.go +++ b/pkg/registry/pushref.go @@ -36,7 +36,8 @@ func BuildPushRef(href, chartName, chartVersion string) (string, error) { normalizedVersion := strings.ReplaceAll(chartVersion, "+", "_") // if href tag present, it must match normalized chart version if ref.Tag != "" && ref.Tag != normalizedVersion { - return "", fmt.Errorf("tag %q does not match provided chart version %q", ref.Tag, chartVersion) + normalizedTag := strings.ReplaceAll(ref.Tag, "_", "+") + return "", fmt.Errorf("tag %q does not match provided chart version %q", normalizedTag, chartVersion) } // Ensure repository ends with the chart name once (avoid duplication)