From 95be3602b862436a538402263ee72798b97c3b22 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Fri, 10 Apr 2026 19:49:11 +0100 Subject: [PATCH] Address copilot comment about skipping empty docs Signed-off-by: Matheus Pimenta --- pkg/release/v1/util/manifest.go | 2 +- pkg/release/v1/util/manifest_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/release/v1/util/manifest.go b/pkg/release/v1/util/manifest.go index a9d8b22d4..992a4af04 100644 --- a/pkg/release/v1/util/manifest.go +++ b/pkg/release/v1/util/manifest.go @@ -58,7 +58,7 @@ func SplitManifests(bigFile string) map[string]string { docs := sep.Split(bigFileTmp, -1) var count int for _, d := range docs { - if d == "" { + if strings.TrimSpace(d) == "" { continue } diff --git a/pkg/release/v1/util/manifest_test.go b/pkg/release/v1/util/manifest_test.go index e6172f01e..579c7f891 100644 --- a/pkg/release/v1/util/manifest_test.go +++ b/pkg/release/v1/util/manifest_test.go @@ -69,6 +69,13 @@ spec: input: " \n\n \n", expected: map[string]string{}, }, + { + name: "whitespace-only doc after separator is skipped", + input: "---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n name: cm1\n---\n \n", + expected: map[string]string{ + "manifest-0": "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: cm1", + }, + }, { name: "single doc no separator", input: `