return on part done

This commit is contained in:
Michael Yang 2024-05-14 12:41:03 -07:00
parent 7ca71a6b0f
commit ac145f75ca

View file

@ -221,7 +221,7 @@ func (b *blobDownload) downloadChunk(ctx context.Context, requestURL *url.URL, w
}
defer resp.Body.Close()
n, err := io.Copy(w, io.TeeReader(resp.Body, part))
n, err := io.CopyN(w, io.TeeReader(resp.Body, part), part.Size)
if err != nil && !errors.Is(err, context.Canceled) && !errors.Is(err, io.ErrUnexpectedEOF) {
// rollback progress
b.Completed.Add(-n)