fix: use io.ReadFull
This commit is contained in:
parent
b756ad73e9
commit
72fed662e8
|
@ -47,8 +47,8 @@ func (v *Verifier) Read(p []byte) (int, error) {
|
||||||
buf := make([]byte, VERIFY_CHUNK_SIZE)
|
buf := make([]byte, VERIFY_CHUNK_SIZE)
|
||||||
// Continue reading from the source and verifying until we have enough data or hit an error
|
// Continue reading from the source and verifying until we have enough data or hit an error
|
||||||
for v.buffer.Len() < len(p)-n {
|
for v.buffer.Len() < len(p)-n {
|
||||||
bytesRead, err := v.r.Read(buf)
|
bytesRead, err := io.ReadFull(v.r, buf)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {
|
||||||
return n, err // Return any read error immediately
|
return n, err // Return any read error immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue