From 2ecd33086f38491d31faaa68af031027b72bbd7f Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Mon, 12 Jun 2023 13:48:33 -0700 Subject: [PATCH] fix: copy progress crash (#4596) Fix naked type assertion crash on `mc cp` with no output. Fixes #4595 --- cmd/cp-main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/cp-main.go b/cmd/cp-main.go index 25c180ba..8eca651a 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -554,9 +554,11 @@ func doCopySession(ctx context.Context, cancelCopy context.CancelFunc, cli *cli. } else { // Print the copy resume summary once in start if startContinue && cli.Bool("continue") { - startSize := humanize.IBytes(uint64(pg.(*progressBar).Start().Get())) - totalSize := humanize.IBytes(uint64(pg.(*progressBar).Total)) - console.Println("Resuming copy from ", startSize, " / ", totalSize) + if pb, ok := pg.(*progressBar); ok { + startSize := humanize.IBytes(uint64(pb.Start().Get())) + totalSize := humanize.IBytes(uint64(pb.Total)) + console.Println("Resuming copy from ", startSize, " / ", totalSize) + } startContinue = false } parallel.queueTask(func() URLs {