Fixes uploaded to sort completedParts before completing the upload
This commit is contained in:
parent
f91a84b7eb
commit
7eef0b6e25
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go-v2/aws"
|
"github.com/aws/aws-sdk-go-v2/aws"
|
||||||
|
@ -187,6 +188,11 @@ outer:
|
||||||
uploadedBytes += result.size
|
uploadedBytes += result.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the parts may be out of order, especially with slow network conditions:
|
||||||
|
sort.Slice(completedParts, func(i, j int) bool {
|
||||||
|
return completedParts[i].PartNumber < completedParts[j].PartNumber
|
||||||
|
})
|
||||||
|
|
||||||
completeInput := s3.CompleteMultipartUploadInput{
|
completeInput := s3.CompleteMultipartUploadInput{
|
||||||
Bucket: aws.String(bucket),
|
Bucket: aws.String(bucket),
|
||||||
Key: aws.String(key),
|
Key: aws.String(key),
|
||||||
|
|
Loading…
Reference in New Issue