diff options
Diffstat (limited to 'vendor/github.com/minio')
9 files changed, 85 insertions, 16 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/.gitignore b/vendor/github.com/minio/minio-go/v7/.gitignore index 12ecd6ae9..8ae0384eb 100644 --- a/vendor/github.com/minio/minio-go/v7/.gitignore +++ b/vendor/github.com/minio/minio-go/v7/.gitignore @@ -2,4 +2,5 @@  *.test  validator  golangci-lint -functional_tests
\ No newline at end of file +functional_tests +.idea
\ No newline at end of file diff --git a/vendor/github.com/minio/minio-go/v7/api-get-object.go b/vendor/github.com/minio/minio-go/v7/api-get-object.go index b17f3146b..e31e4cf92 100644 --- a/vendor/github.com/minio/minio-go/v7/api-get-object.go +++ b/vendor/github.com/minio/minio-go/v7/api-get-object.go @@ -23,8 +23,6 @@ import (  	"fmt"  	"io"  	"net/http" -	"net/url" -	"strconv"  	"sync"  	"github.com/minio/minio-go/v7/pkg/s3utils" @@ -654,19 +652,11 @@ func (c *Client) getObject(ctx context.Context, bucketName, objectName string, o  		return nil, ObjectInfo{}, nil, err  	} -	urlValues := make(url.Values) -	if opts.VersionID != "" { -		urlValues.Set("versionId", opts.VersionID) -	} -	if opts.PartNumber > 0 { -		urlValues.Set("partNumber", strconv.Itoa(opts.PartNumber)) -	} -  	// Execute GET on objectName.  	resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{  		bucketName:       bucketName,  		objectName:       objectName, -		queryValues:      urlValues, +		queryValues:      opts.toQueryValues(),  		customHeader:     opts.Header(),  		contentSHA256Hex: emptySHA256Hex,  	}) diff --git a/vendor/github.com/minio/minio-go/v7/api-get-options.go b/vendor/github.com/minio/minio-go/v7/api-get-options.go index 0082c1fa7..bb86a5994 100644 --- a/vendor/github.com/minio/minio-go/v7/api-get-options.go +++ b/vendor/github.com/minio/minio-go/v7/api-get-options.go @@ -20,6 +20,8 @@ package minio  import (  	"fmt"  	"net/http" +	"net/url" +	"strconv"  	"time"  	"github.com/minio/minio-go/v7/pkg/encrypt" @@ -36,6 +38,7 @@ type AdvancedGetOptions struct {  // during GET requests.  type GetObjectOptions struct {  	headers              map[string]string +	reqParams            url.Values  	ServerSideEncryption encrypt.ServerSide  	VersionID            string  	PartNumber           int @@ -83,6 +86,34 @@ func (o *GetObjectOptions) Set(key, value string) {  	o.headers[http.CanonicalHeaderKey(key)] = value  } +// SetReqParam - set request query string parameter +// supported key: see supportedQueryValues. +// If an unsupported key is passed in, it will be ignored and nothing will be done. +func (o *GetObjectOptions) SetReqParam(key, value string) { +	if !isStandardQueryValue(key) { +		// do nothing +		return +	} +	if o.reqParams == nil { +		o.reqParams = make(url.Values) +	} +	o.reqParams.Set(key, value) +} + +// AddReqParam - add request query string parameter +// supported key: see supportedQueryValues. +// If an unsupported key is passed in, it will be ignored and nothing will be done. +func (o *GetObjectOptions) AddReqParam(key, value string) { +	if !isStandardQueryValue(key) { +		// do nothing +		return +	} +	if o.reqParams == nil { +		o.reqParams = make(url.Values) +	} +	o.reqParams.Add(key, value) +} +  // SetMatchETag - set match etag.  func (o *GetObjectOptions) SetMatchETag(etag string) error {  	if etag == "" { @@ -149,3 +180,24 @@ func (o *GetObjectOptions) SetRange(start, end int64) error {  	}  	return nil  } + +// toQueryValues - Convert the versionId, partNumber, and reqParams in Options to query string parameters. +func (o *GetObjectOptions) toQueryValues() url.Values { +	urlValues := make(url.Values) +	if o.VersionID != "" { +		urlValues.Set("versionId", o.VersionID) +	} +	if o.PartNumber > 0 { +		urlValues.Set("partNumber", strconv.Itoa(o.PartNumber)) +	} + +	if o.reqParams != nil { +		for key, values := range o.reqParams { +			for _, value := range values { +				urlValues.Add(key, value) +			} +		} +	} + +	return urlValues +} diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go index cdc7d3d38..55b3f38e6 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go @@ -500,8 +500,6 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam  	// CRC32C is ~50% faster on AMD64 @ 30GB/s  	var crcBytes []byte  	crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) -	md5Hash := c.md5Hasher() -	defer md5Hash.Close()  	// Total data read and written to server. should be equal to 'size' at the end of the call.  	var totalUploadedSize int64 @@ -569,9 +567,10 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam  			var md5Base64 string  			if opts.SendContentMd5 { -				md5Hash.Reset() +				md5Hash := c.md5Hasher()  				md5Hash.Write(buf[:length])  				md5Base64 = base64.StdEncoding.EncodeToString(md5Hash.Sum(nil)) +				md5Hash.Close()  			}  			defer wg.Done() @@ -590,6 +589,7 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam  			objPart, uerr := c.uploadPart(ctx, p)  			if uerr != nil {  				errCh <- uerr +				return  			}  			// Save successfully uploaded part metadata. diff --git a/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go b/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go index 899bc6b73..849471e33 100644 --- a/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go +++ b/vendor/github.com/minio/minio-go/v7/api-putobject-snowball.go @@ -59,6 +59,7 @@ type SnowballObject struct {  	Size int64  	// Modtime to apply to the object. +	// If Modtime is the zero value current time will be used.  	ModTime time.Time  	// Content of the object. @@ -172,6 +173,10 @@ objectLoop:  				ModTime:  obj.ModTime,  				Format:   tar.FormatPAX,  			} +			if header.ModTime.IsZero() { +				header.ModTime = time.Now().UTC() +			} +  			if err := t.WriteHeader(&header); err != nil {  				closeObj()  				return err diff --git a/vendor/github.com/minio/minio-go/v7/api.go b/vendor/github.com/minio/minio-go/v7/api.go index 99a03df95..c26fe6e72 100644 --- a/vendor/github.com/minio/minio-go/v7/api.go +++ b/vendor/github.com/minio/minio-go/v7/api.go @@ -118,7 +118,7 @@ type Options struct {  // Global constants.  const (  	libraryName    = "minio-go" -	libraryVersion = "v7.0.47" +	libraryVersion = "v7.0.48"  )  // User Agent should always following the below style. diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_tls_identity.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_tls_identity.go index a0ad09046..dee0a8cbb 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_tls_identity.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_tls_identity.go @@ -140,6 +140,9 @@ func (i *STSCertificateIdentity) Retrieve() (Value, error) {  	if err != nil {  		return Value{}, err  	} +	if req.Form == nil { +		req.Form = url.Values{} +	}  	req.Form.Add("DurationSeconds", strconv.FormatUint(uint64(livetime.Seconds()), 10))  	resp, err := i.Client.Do(req) diff --git a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go index 589c0e549..8bf2e5baa 100644 --- a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go +++ b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go @@ -48,6 +48,7 @@ var awsS3EndpointMap = map[string]string{  	"cn-north-1":     "s3.dualstack.cn-north-1.amazonaws.com.cn",  	"cn-northwest-1": "s3.dualstack.cn-northwest-1.amazonaws.com.cn",  	"ap-southeast-3": "s3.dualstack.ap-southeast-3.amazonaws.com", +	"ap-southeast-4": "s3.dualstack.ap-southeast-4.amazonaws.com",  }  // getS3Endpoint get Amazon S3 endpoint based on the bucket location. diff --git a/vendor/github.com/minio/minio-go/v7/utils.go b/vendor/github.com/minio/minio-go/v7/utils.go index 7ce8ec5ca..9389a7faf 100644 --- a/vendor/github.com/minio/minio-go/v7/utils.go +++ b/vendor/github.com/minio/minio-go/v7/utils.go @@ -511,6 +511,23 @@ func isAmzHeader(headerKey string) bool {  	return strings.HasPrefix(key, "x-amz-meta-") || strings.HasPrefix(key, "x-amz-grant-") || key == "x-amz-acl" || isSSEHeader(headerKey) || strings.HasPrefix(key, "x-amz-checksum-")  } +// supportedQueryValues is a list of query strings that can be passed in when using GetObject. +var supportedQueryValues = map[string]bool{ +	"partNumber":                   true, +	"versionId":                    true, +	"response-cache-control":       true, +	"response-content-disposition": true, +	"response-content-encoding":    true, +	"response-content-language":    true, +	"response-content-type":        true, +	"response-expires":             true, +} + +// isStandardQueryValue will return true when the passed in query string parameter is supported rather than customized. +func isStandardQueryValue(qsKey string) bool { +	return supportedQueryValues[qsKey] +} +  var (  	md5Pool    = sync.Pool{New: func() interface{} { return md5.New() }}  	sha256Pool = sync.Pool{New: func() interface{} { return sha256.New() }}  | 
