From f4746f5064e057d977cd9832c07cf97d403f2212 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 2 Dec 2019 17:00:54 +0000 Subject: [PATCH] s3: fix multipart copy - fixes #3778 Before this change multipart copies were giving the error Range specified is not valid for source object of size This was due to an off by one error in the range source introduced in 7b1274e29ac51231 "s3: support for multipart copy" --- backend/s3/s3.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 991e5bf4b..a507c9078 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1666,8 +1666,8 @@ func calculateRange(partSize, partIndex, numParts, totalSize int64) string { start := partIndex * partSize var ends string if partIndex == numParts-1 { - if totalSize >= 0 { - ends = strconv.FormatInt(totalSize, 10) + if totalSize >= 1 { + ends = strconv.FormatInt(totalSize-1, 10) } } else { ends = strconv.FormatInt(start+partSize-1, 10)