File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -426,7 +426,13 @@ async fn ReadAll(mut r: Reader)!: []byte {
426426 // Invariant: finalSize = sum(len(c) for c in chunks)
427427 let mut finalSize: int
428428 for {
429- n := r.Read(b[len(b):cap(b)]).await else { break }
429+ n := r.Read(b[len(b):cap(b)]).await else {
430+ // If any data was read, ignore the error and return the data.
431+ if len(chunks) > 0 || len(b) > 0 {
432+ break
433+ }
434+ error(error)
435+ }
430436 if n == EOF {
431437 break
432438 }
@@ -439,6 +445,8 @@ async fn ReadAll(mut r: Reader)!: []byte {
439445 next += next / 2
440446 }
441447 }
448+ // On error this condition must be true: len(chunks) > 0 || len(b) > 0
449+ // On EOF, len(chunks) and len(b) may be zero.
442450 if len(chunks) == 0 {
443451 ret b
444452 }
You can’t perform that action at this time.
0 commit comments