From 123a317f78743f81658efcf859fe9244480ed217 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Fri, 10 Jul 2026 12:29:51 -0600 Subject: [PATCH] test: handle io.ReadAll errors in registry test handler Signed-off-by: Terry Howe --- pkg/registry/client_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/registry/client_test.go b/pkg/registry/client_test.go index 56b91f9ec..690a51024 100644 --- a/pkg/registry/client_test.go +++ b/pkg/registry/client_test.go @@ -186,7 +186,11 @@ func TestPushConcurrent(t *testing.T) { case r.Method == http.MethodPut && strings.Contains(r.URL.Path, "/blobs/uploads/"): // Complete upload - extract digest from query param - body, _ := io.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } digest := r.URL.Query().Get("digest") mu.Lock() uploads[r.URL.Path] = body @@ -196,7 +200,11 @@ func TestPushConcurrent(t *testing.T) { case r.Method == http.MethodPut && strings.Contains(r.URL.Path, "/manifests/"): // Manifest push - compute actual sha256 digest of the body - body, _ := io.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } hash := sha256.Sum256(body) digest := fmt.Sprintf("sha256:%x", hash) w.Header().Set("Docker-Content-Digest", digest)