Skip to content

Commit cd84841

Browse files
docs: clarify PutObject with '-1' content-length
fixes #1478
1 parent 001628e commit cd84841

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

api-put-object.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,20 @@ func (a completedParts) Less(i, j int) bool { return a[i].PartNumber < a[j].Part
214214
//
215215
// You must have WRITE permissions on a bucket to create an object.
216216
//
217-
// - For size smaller than 128MiB PutObject automatically does a
218-
// single atomic Put operation.
219-
// - For size larger than 128MiB PutObject automatically does a
220-
// multipart Put operation.
217+
// - For size smaller than 16MiB PutObject automatically does a
218+
// single atomic PUT operation.
219+
//
220+
// - For size larger than 16MiB PutObject automatically does a
221+
// multipart upload operation.
222+
//
221223
// - For size input as -1 PutObject does a multipart Put operation
222224
// until input stream reaches EOF. Maximum object size that can
223225
// be uploaded through this operation will be 5TiB.
226+
//
227+
// WARNING: Passing down '-1' will use memory and these cannot
228+
// be reused for best outcomes for PutObject(), pass the size always.
229+
//
230+
// NOTE: Upon errors during upload multipart operation is entirely aborted.
224231
func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64,
225232
opts PutObjectOptions) (info UploadInfo, err error) {
226233
if objectSize < 0 && opts.DisableMultipart {

pkg/policy/bucket-policy-condition_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
package policy
1919

2020
import (
21+
"encoding/json"
2122
"testing"
2223

23-
jsoniter "github.com/json-iterator/go"
2424
"github.com/minio/minio-go/v7/pkg/set"
2525
)
2626

27-
var json = jsoniter.ConfigCompatibleWithStandardLibrary
28-
2927
// ConditionKeyMap.Add() is called and the result is validated.
3028
func TestConditionKeyMapAdd(t *testing.T) {
3129
condKeyMap := make(ConditionKeyMap)

pkg/policy/bucket-policy.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
package policy
1919

2020
import (
21+
"encoding/json"
2122
"errors"
2223
"reflect"
2324
"strings"
2425

25-
jsoniter "github.com/json-iterator/go"
2626
"github.com/minio/minio-go/v7/pkg/set"
2727
)
2828

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

0 commit comments

Comments
 (0)