From b9b535c21821868139d5271ff719ec8b27795d71 Mon Sep 17 00:00:00 2001 From: Cloud-Architect-Emma Date: Sun, 31 May 2026 20:18:23 +0100 Subject: [PATCH] fix(template): use TrimSuffix instead of TrimRight to avoid over-stripping TrimRight strips all trailing newlines which could affect templates that intentionally end without a trailing newline (see #31948). TrimSuffix removes at most one trailing newline, which is sufficient to fix the double-newline regression from #32163. Co-authored-by: Cloud-Architect-Emma Signed-off-by: Cloud-Architect-Emma --- pkg/action/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 5cf9980af..79d4c674a 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -732,7 +732,7 @@ func writeToFile(outputDir string, name string, data string, appendData bool) er defer f.Close() - _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, strings.TrimRight(data, "\n")) + _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, strings.TrimSuffix(data, "\n")) if err != nil { return err