fix: use io.ReadFull

This commit is contained in:
Derrick Hammer 2024-02-28 10:42:01 -05:00
parent b756ad73e9
commit 72fed662e8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -47,8 +47,8 @@ func (v *Verifier) Read(p []byte) (int, error) {
buf := make([]byte, VERIFY_CHUNK_SIZE)
// Continue reading from the source and verifying until we have enough data or hit an error
for v.buffer.Len() < len(p)-n {
bytesRead, err := v.r.Read(buf)
if err != nil && err != io.EOF {
bytesRead, err := io.ReadFull(v.r, buf)
if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {
return n, err // Return any read error immediately
}