From bf4ba6dfaa07ab00581997bd26ded0fe9302a71c Mon Sep 17 00:00:00 2001 From: Joe Reuss Date: Tue, 5 Dec 2023 16:39:05 -0600 Subject: [PATCH] Fix merge conflicts Also fixes issues with progress bars for recursive uploads. It is at the same state as recursive downloads so it looks fine without debug logging but is wonky with it. Functionality should work fine. --- client/handle_http.go | 11 ++++++++++- cmd/object_copy.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/handle_http.go b/client/handle_http.go index 1deeafe02..a6ece1046 100644 --- a/client/handle_http.go +++ b/client/handle_http.go @@ -768,6 +768,10 @@ func UploadDirectory(src string, dest *url.URL, token string, namespace namespac } amountDownloaded += downloaded } + // Close progress bar container + if ObjectClientOptions.ProgressBars { + progressContainer.Wait() + } return amountDownloaded, err } @@ -873,7 +877,12 @@ func UploadFile(src string, origDest *url.URL, token string, namespace namespace } else { progressBar.Abort(true) } - progressContainer.Wait() + // If it is recursive, we need to reuse the mpb instance. Closed later + if ObjectClientOptions.Recursive { + progressBar.Wait() + } else { // If not recursive, go ahead and close it + progressContainer.Wait() + } }() } tickerDuration := 500 * time.Millisecond diff --git a/cmd/object_copy.go b/cmd/object_copy.go index 44ff6fc5f..1f22fabf2 100644 --- a/cmd/object_copy.go +++ b/cmd/object_copy.go @@ -202,6 +202,7 @@ func copyMain(cmd *cobra.Command, args []string) { for _, src := range source { var tmpDownloaded int64 isRecursive, _ := cmd.Flags().GetBool("recursive") + client.ObjectClientOptions.Recursive = isRecursive tmpDownloaded, result = client.DoStashCPSingle(src, dest, splitMethods, isRecursive) downloaded += tmpDownloaded if result != nil {