Skip to content

Commit

Permalink
Merge pull request agola-io#152 from sgotti/objectstorage_s3_use_limi…
Browse files Browse the repository at this point in the history
…treader

objectstorage s3: use limitreader in write object
  • Loading branch information
sgotti authored Oct 25, 2019
2 parents 5d6ebf0 + 5f119d0 commit 438afc8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/objectstorage/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func (s *S3Storage) WriteObject(filepath string, data io.Reader, size int64, per
// An alternative is to write the file locally so we can calculate the size and
// then put it. See commented out code below.
if size >= 0 {
_, err := s.minioClient.PutObject(s.bucket, filepath, data, size, minio.PutObjectOptions{ContentType: "application/octet-stream"})
lr := io.LimitReader(data, size)
_, err := s.minioClient.PutObject(s.bucket, filepath, lr, size, minio.PutObjectOptions{ContentType: "application/octet-stream"})
return err
}

Expand Down

0 comments on commit 438afc8

Please sign in to comment.