Skip to content

Commit

Permalink
Support S3 multipart uploads
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Fillon <adrien.fillon@cdiscount.com>
  • Loading branch information
adrien-f committed Nov 6, 2018
1 parent 78e412c commit e40f6cb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/objstore/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,15 @@ func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) {

// Upload the contents of the reader as an object into the bucket.
func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {
_, err := b.client.PutObjectWithContext(ctx, b.name, name, r, -1,
fileSize := int64(-1)
fileInfo, err := r.(*os.File).Stat()
if err != nil {
return errors.Errorf("Could not stat local file %s", name)
} else {
fileSize = fileInfo.Size()
}

_, err = b.client.PutObjectWithContext(ctx, b.name, name, r, fileSize,
minio.PutObjectOptions{ServerSideEncryption: b.sse},
)

Expand Down

0 comments on commit e40f6cb

Please sign in to comment.