diff --git a/api/utils/accessio/lookaheadreader.go b/api/utils/accessio/lookaheadreader.go index b2ee53b86f..7a08d33813 100644 --- a/api/utils/accessio/lookaheadreader.go +++ b/api/utils/accessio/lookaheadreader.go @@ -28,7 +28,12 @@ func (r *LookAheadReader) Read(p []byte) (int, error) { return r.read(p) } -func (r *LookAheadReader) read(p []byte) (n int, err error) { +func (r *LookAheadReader) read(p []byte) (int, error) { + var ( + n int + err error + ) + if r.buffer != nil && r.buffer.Len() > 0 { // first, consume from buffer n, err = r.buffer.Read(p)