fix: etag has to be provided to multipart complete

This commit is contained in:
Derrick Hammer 2024-02-01 21:14:44 -05:00
parent 185f5de87a
commit a3846a8e07
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 4 deletions

View File

@ -169,7 +169,7 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error {
if end > size { if end > size {
end = size end = size
} }
nextChan := make(chan struct{}, 0) nextChan := make(chan string, 0)
errChan := make(chan error, 0) errChan := make(chan error, 0)
partNumber := int(i + 1) partNumber := int(i + 1)
@ -189,12 +189,12 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error {
return err 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 { if err != nil {
return err return err
} }
nextChan <- struct{}{} nextChan <- ret.ETag
return nil return nil
}, },
Limit: 10, Limit: 10,
@ -219,7 +219,8 @@ func (r *RenterDefault) MultipartUpload(params MultiPartUploadParams) error {
select { select {
case err = <-errChan: case err = <-errChan:
return fmt.Errorf("failed to upload part %d: %s", i, err.Error()) return fmt.Errorf("failed to upload part %d: %s", i, err.Error())
case <-nextChan: case etag := <-nextChan:
uploadParts[i].ETag = etag
} }
} }