1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-12-23 05:46:30 +00:00

Merge pull request #68 from mtrmac/read-0-nil

Correctly handle Read returning (0, nil)
This commit is contained in:
Vincent Batts 2023-07-22 13:09:38 -04:00 committed by GitHub
commit 5ef0dd8243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,9 +135,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
} }
isEOF = true isEOF = true
} }
if n == 0 { if n != 0 {
break
}
_, err = p.AddEntry(storage.Entry{ _, err = p.AddEntry(storage.Entry{
Type: storage.SegmentType, Type: storage.SegmentType,
Payload: paddingChunk[:n], Payload: paddingChunk[:n],
@ -146,6 +144,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
pW.CloseWithError(err) pW.CloseWithError(err)
return return
} }
}
if isEOF { if isEOF {
break break
} }