From dd8502f7b4fd5824a696c99909babd0fbed77e9e Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Tue, 29 Jul 2025 15:37:57 -0400 Subject: [PATCH] Handle messy index files Signed-off-by: Matt Farina (cherry picked from commit 69efc0d4fbcc143e0b196253f6e82808aaa57fc3) (cherry picked from commit 039b0b18d3c83c9aa3a80da67f3cf1c2d965a598) --- pkg/repo/index.go | 1 + pkg/repo/index_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/repo/index.go b/pkg/repo/index.go index e1ce3c62d..a93314ab8 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -357,6 +357,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { for idx := len(cvs) - 1; idx >= 0; idx-- { if cvs[idx] == nil { log.Printf("skipping loading invalid entry for chart %q from %s: empty entry", name, source) + cvs = append(cvs[:idx], cvs[idx+1:]...) continue } // When metadata section missing, initialize with no data diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index a1e3e9438..1fb30f3c0 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -68,6 +68,7 @@ entries: grafana: - apiVersion: v2 name: grafana + - null foo: - bar: