Skip to content

Commit

Permalink
docs: clarify PutObject with '-1' content-length
Browse files Browse the repository at this point in the history
fixes #1478
  • Loading branch information
harshavardhana committed Dec 7, 2021
1 parent 001628e commit cd84841
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
15 changes: 11 additions & 4 deletions api-put-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,20 @@ func (a completedParts) Less(i, j int) bool { return a[i].PartNumber < a[j].Part
//
// You must have WRITE permissions on a bucket to create an object.
//
// - For size smaller than 128MiB PutObject automatically does a
// single atomic Put operation.
// - For size larger than 128MiB PutObject automatically does a
// multipart Put operation.
// - For size smaller than 16MiB PutObject automatically does a
// single atomic PUT operation.
//
// - For size larger than 16MiB PutObject automatically does a
// multipart upload operation.
//
// - For size input as -1 PutObject does a multipart Put operation
// until input stream reaches EOF. Maximum object size that can
// be uploaded through this operation will be 5TiB.
//
// WARNING: Passing down '-1' will use memory and these cannot
// be reused for best outcomes for PutObject(), pass the size always.
//
// NOTE: Upon errors during upload multipart operation is entirely aborted.
func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64,
opts PutObjectOptions) (info UploadInfo, err error) {
if objectSize < 0 && opts.DisableMultipart {
Expand Down
4 changes: 1 addition & 3 deletions pkg/policy/bucket-policy-condition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
package policy

import (
"encoding/json"
"testing"

jsoniter "github.com/json-iterator/go"
"github.com/minio/minio-go/v7/pkg/set"
)

var json = jsoniter.ConfigCompatibleWithStandardLibrary

// ConditionKeyMap.Add() is called and the result is validated.
func TestConditionKeyMapAdd(t *testing.T) {
condKeyMap := make(ConditionKeyMap)
Expand Down
3 changes: 1 addition & 2 deletions pkg/policy/bucket-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
package policy

import (
"encoding/json"
"errors"
"reflect"
"strings"

jsoniter "github.com/json-iterator/go"
"github.com/minio/minio-go/v7/pkg/set"
)

Expand Down Expand Up @@ -89,7 +89,6 @@ type User struct {
// User string but it can also take a string.
func (u *User) UnmarshalJSON(data []byte) error {
// Try to unmarshal data in a struct equal to User,
var json = jsoniter.ConfigCompatibleWithStandardLibrary
// to avoid infinite recursive call of this function
type AliasUser User
var au AliasUser
Expand Down

0 comments on commit cd84841

Please sign in to comment.