From 76a421ec9aa1ff02fc0ad1a6c0e7c5255fd3970d Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 25 Jul 2023 14:19:20 +0200 Subject: [PATCH] progress: set Current before Refill the mpb.Progress doesn't allow to set the Refill value bigger than Current so make sure we set Current before setting Refill otherwise we will report the wrong number of skipped bytes. Signed-off-by: Giuseppe Scrivano --- copy/single.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/copy/single.go b/copy/single.go index 37b1bfe98..02651bd4c 100644 --- a/copy/single.go +++ b/copy/single.go @@ -743,7 +743,9 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to uploadedBlob, err := ic.c.dest.PutBlobPartial(ctx, &proxy, srcInfo, ic.c.blobInfoCache) if err == nil { if srcInfo.Size != -1 { - bar.SetRefill(srcInfo.Size - bar.Current()) + refill := srcInfo.Size - bar.Current() + bar.SetCurrent(srcInfo.Size) + bar.SetRefill(refill) } bar.mark100PercentComplete() hideProgressBar = false