diff --git a/archive/archive.go b/archive/archive.go index 4f8db0b..ad3d65b 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -359,7 +359,7 @@ func (ta *tarAppender) addTarFile(path, name string) error { return err } - if hdr.Typeflag == tar.TypeReg { + if hdr.Typeflag == tar.TypeReg && hdr.Size > 0 { file, err := os.Open(path) if err != nil { return err diff --git a/archive/archive_linux.go b/archive/archive_linux.go index 86d2c7f..277ff98 100644 --- a/archive/archive_linux.go +++ b/archive/archive_linux.go @@ -26,6 +26,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os hdr.Name = WhiteoutPrefix + hdr.Name hdr.Mode = 0600 hdr.Typeflag = tar.TypeReg + hdr.Size = 0 } if fi.Mode()&os.ModeDir != 0 {