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.
This commit is contained in:
Nick Craig-Wood 2025-05-28 17:04:35 +01:00
parent aeb43c6a4c
commit 0ee7cd80f2

View File

@ -1768,7 +1768,7 @@ func (f *Fs) copyMultipart(ctx context.Context, remote, dstContainer, dstPath st
var ( var (
srcSize = src.size srcSize = src.size
partSize = int64(chunksize.Calculator(o, src.size, blockblob.MaxBlocks, f.opt.ChunkSize)) 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 blockIDs = make([]string, numParts) // list of blocks for finalize
g, gCtx = errgroup.WithContext(ctx) g, gCtx = errgroup.WithContext(ctx)
checker = newCheckForInvalidBlockOrBlob("copy", o) checker = newCheckForInvalidBlockOrBlob("copy", o)