Fix download retry issue

This commit is contained in:
Tim Scheuermann 2024-05-24 20:30:42 +02:00 committed by GitHub
parent afd2b058b4
commit db2ffa79f1
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)