Fix for zero-sized layers
Moved a defer up to a better spot. Fixed TestUntarPathWithInvalidDest to actually fail for the right reason Closes #18170 Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
5ca1b7ff65
commit
baafebd598
2 changed files with 15 additions and 4 deletions
|
@ -128,7 +128,13 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
|||
p := pools.BufioReader32KPool
|
||||
buf := p.Get(archive)
|
||||
bs, err := buf.Peek(10)
|
||||
if err != nil {
|
||||
if err != nil && err != io.EOF {
|
||||
// Note: we'll ignore any io.EOF error because there are some odd
|
||||
// cases where the layer.tar file will be empty (zero bytes) and
|
||||
// that results in an io.EOF from the Peek() call. So, in those
|
||||
// cases we'll just treat it as a non-compressed stream and
|
||||
// that means just create an empty layer.
|
||||
// See Issue 18170
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue