From 9b5779799f1668f6116d3f5ff83022139bb94030 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 24 Oct 2024 20:49:12 +0100 Subject: [PATCH] Fix tar handling --- pis/update.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pis/update.go b/pis/update.go index c3544fb..ee64df5 100644 --- a/pis/update.go +++ b/pis/update.go @@ -98,7 +98,6 @@ func extractFiles(gzipStream io.Reader, dest string) error { if err != nil { return err } - defer uncompressedStream.Close() tarReader := tar.NewReader(uncompressedStream) @@ -112,6 +111,12 @@ func extractFiles(gzipStream io.Reader, dest string) error { return err } + // Handle pax_global_header or other unsupported types + if header.Typeflag == tar.TypeXGlobalHeader || header.Name == "pax_global_header" { + // Skip this special header file + continue + } + filePath := filepath.Join(dest, header.Name) switch header.Typeflag { @@ -124,7 +129,6 @@ func extractFiles(gzipStream io.Reader, dest string) error { if err != nil { return err } - if _, err := io.Copy(outFile, tarReader); err != nil { return err }