From 0ee7cd80f229f285b11dd2043188fce3c8cdf7f2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 28 May 2025 17:04:35 +0100 Subject: [PATCH] azureblob: fix multipart server side copies of 0 sized files Before this fix multipart server side copies would fail. This problem was due to an incorrect calculation of the number of parts to transfer - it calculated 1 part to transfer rather than 0. --- backend/azureblob/azureblob.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 6a966bb75..b6ed82d20 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -1768,7 +1768,7 @@ func (f *Fs) copyMultipart(ctx context.Context, remote, dstContainer, dstPath st var ( srcSize = src.size partSize = int64(chunksize.Calculator(o, src.size, blockblob.MaxBlocks, f.opt.ChunkSize)) - numParts = (srcSize-1)/partSize + 1 + numParts = (srcSize + partSize - 1) / partSize blockIDs = make([]string, numParts) // list of blocks for finalize g, gCtx = errgroup.WithContext(ctx) checker = newCheckForInvalidBlockOrBlob("copy", o)