Fix tar handling
All checks were successful
Go Test / test (push) Successful in 1m4s

This commit is contained in:
Fred Boniface 2024-10-24 20:49:12 +01:00
parent 28995790cc
commit 9b5779799f

View File

@ -98,7 +98,6 @@ func extractFiles(gzipStream io.Reader, dest string) error {
if err != nil { if err != nil {
return err return err
} }
defer uncompressedStream.Close() defer uncompressedStream.Close()
tarReader := tar.NewReader(uncompressedStream) tarReader := tar.NewReader(uncompressedStream)
@ -112,6 +111,12 @@ func extractFiles(gzipStream io.Reader, dest string) error {
return err 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) filePath := filepath.Join(dest, header.Name)
switch header.Typeflag { switch header.Typeflag {
@ -124,7 +129,6 @@ func extractFiles(gzipStream io.Reader, dest string) error {
if err != nil { if err != nil {
return err return err
} }
if _, err := io.Copy(outFile, tarReader); err != nil { if _, err := io.Copy(outFile, tarReader); err != nil {
return err return err
} }