Merge pull request #4619 from noxer/patch-1

Fix download retry issue
This commit is contained in:
Michael Yang 2024-05-24 17:21:57 -07:00 committed by GitHub
commit 6adca97f37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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