From c852b8e0214a727d44300270db3672837b93dbb8 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 4 Feb 2025 19:30:49 -0800 Subject: [PATCH] server: always print upload/download part info (#8832) --- server/download.go | 5 ++++- server/upload.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/download.go b/server/download.go index 1674bffd6..857b16926 100644 --- a/server/download.go +++ b/server/download.go @@ -170,9 +170,12 @@ func (b *blobDownload) Prepare(ctx context.Context, requestURL *url.URL, opts *r offset += size } - } else { + } + + if len(b.Parts) > 0 { slog.Info(fmt.Sprintf("downloading %s in %d %s part(s)", b.Digest[7:19], len(b.Parts), format.HumanBytes(b.Parts[0].Size))) } + return nil } diff --git a/server/upload.go b/server/upload.go index 020e89551..312545eec 100644 --- a/server/upload.go +++ b/server/upload.go @@ -108,7 +108,9 @@ func (b *blobUpload) Prepare(ctx context.Context, requestURL *url.URL, opts *reg offset += size } - slog.Info(fmt.Sprintf("uploading %s in %d %s part(s)", b.Digest[7:19], len(b.Parts), format.HumanBytes(b.Parts[0].Size))) + if len(b.Parts) > 0 { + slog.Info(fmt.Sprintf("uploading %s in %d %s part(s)", b.Digest[7:19], len(b.Parts), format.HumanBytes(b.Parts[0].Size))) + } requestURL, err = url.Parse(location) if err != nil {