From cc7e544b851922f884537ff0874f6a647121b15c Mon Sep 17 00:00:00 2001 From: Ramon de Klein Date: Thu, 15 Aug 2024 13:24:41 +0200 Subject: [PATCH 1/2] improve error message when scanning through the tar file --- pkg/apis/minio.min.io/v2/helper.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/apis/minio.min.io/v2/helper.go b/pkg/apis/minio.min.io/v2/helper.go index b68517983f9..3cf02afafc2 100644 --- a/pkg/apis/minio.min.io/v2/helper.go +++ b/pkg/apis/minio.min.io/v2/helper.go @@ -269,6 +269,9 @@ func ExtractTar(filesToExtract []string, basePath, tarFileName string) error { } if err != nil { + if errors.Is(err, io.EOF) { + return fmt.Errorf("Tar file contains only %d from the %d files", len(filesToExtract)-success, len(filesToExtract)) + } return fmt.Errorf("Tar file extraction failed for file index: %d, with: %w", success, err) } if header.Typeflag == tar.TypeReg { From b34caa9c9a2ac25224f5b4cfd1bf9ae96d5264d3 Mon Sep 17 00:00:00 2001 From: Ramon de Klein Date: Fri, 16 Aug 2024 11:47:18 +0200 Subject: [PATCH 2/2] Improve error message Co-authored-by: Shubhendu --- pkg/apis/minio.min.io/v2/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/minio.min.io/v2/helper.go b/pkg/apis/minio.min.io/v2/helper.go index 3cf02afafc2..22927919d58 100644 --- a/pkg/apis/minio.min.io/v2/helper.go +++ b/pkg/apis/minio.min.io/v2/helper.go @@ -270,7 +270,7 @@ func ExtractTar(filesToExtract []string, basePath, tarFileName string) error { if err != nil { if errors.Is(err, io.EOF) { - return fmt.Errorf("Tar file contains only %d from the %d files", len(filesToExtract)-success, len(filesToExtract)) + return fmt.Errorf("Tar file contains only %d out of %d files", len(filesToExtract)-success, len(filesToExtract)) } return fmt.Errorf("Tar file extraction failed for file index: %d, with: %w", success, err) }