From ac145f75ca19ccdebd5277ae4c315d9e67f0b379 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 14 May 2024 12:41:03 -0700 Subject: [PATCH] return on part done --- server/download.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/download.go b/server/download.go index 935af9c1..db4d1f4e 100644 --- a/server/download.go +++ b/server/download.go @@ -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)