From 311659c085faf37f8e80dc43e49c336c54630cc2 Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Mon, 1 Sep 2025 10:36:54 +0200 Subject: [PATCH] Deal with potential chart name with that start with hyphen From copilot review: > The condition i > 0 will fail to split chart names that start with a hyphen followed by a version (e.g., "-chart-1.0.0" would return "-chart-1.0.0", "" instead of "-chart", "1.0.0"). This should be i >= 0 to handle edge cases correctly. https://github.com/helm/helm/pull/31206#discussion_r2311950405 Signed-off-by: Benoit Tigeot --- pkg/action/pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/action/pull.go b/pkg/action/pull.go index 8619e50e4..eadbc4c00 100644 --- a/pkg/action/pull.go +++ b/pkg/action/pull.go @@ -214,7 +214,7 @@ func trimAnySuffix(s string, suffixes ...string) string { } func splitChartNameVersion(s string) (name, version string) { - if i := strings.LastIndex(s, "-"); i > 0 { + if i := strings.LastIndex(s, "-"); i >= 0 { return s[:i], s[i+1:] } return s, ""