From a3846a8e07628b05b0ebed8c9ff52bfc513b64ea Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 1 Feb 2024 21:14:44 -0500 Subject: [PATCH] fix: etag has to be provided to multipart complete --- renter/renter.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/renter/renter.go b/renter/renter.go index 58564a8..8423630 100644 --- a/renter/renter.go +++ b/renter/renter.go @@ -169,7 +169,7 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error { if end > size { end = size } - nextChan := make(chan struct{}, 0) + nextChan := make(chan string, 0) errChan := make(chan error, 0) partNumber := int(i + 1) @@ -189,12 +189,12 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error { return err } - _, err = r.workerClient.UploadMultipartUploadPart(context.Background(), reader, bucket, fileName, upload.UploadID, partNumber, api.UploadMultipartUploadPartOptions{}) + ret, err := r.workerClient.UploadMultipartUploadPart(context.Background(), reader, bucket, fileName, upload.UploadID, partNumber, api.UploadMultipartUploadPartOptions{}) if err != nil { return err } - nextChan <- struct{}{} + nextChan <- ret.ETag return nil }, Limit: 10, @@ -219,7 +219,8 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error { select { case err = <-errChan: return fmt.Errorf("failed to upload part %d: %s", i, err.Error()) - case <-nextChan: + case etag := <-nextChan: + uploadParts[i].ETag = etag } }