[chore]: Bump github.com/minio/minio-go/v7 from 7.0.47 to 7.0.48 (#1486)

Bumps [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) from 7.0.47 to 7.0.48.
- [Release notes](https://github.com/minio/minio-go/releases)
- [Commits](https://github.com/minio/minio-go/compare/v7.0.47...v7.0.48)

---
updated-dependencies:
- dependency-name: github.com/minio/minio-go/v7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-02-13 07:46:15 +00:00 committed by GitHub
parent 33b77b3c1a
commit efbc5dab6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 89 additions and 20 deletions

2
go.mod
View file

@ -34,7 +34,7 @@ require (
github.com/jackc/pgx/v4 v4.17.2 github.com/jackc/pgx/v4 v4.17.2
github.com/microcosm-cc/bluemonday v1.0.22 github.com/microcosm-cc/bluemonday v1.0.22
github.com/miekg/dns v1.1.50 github.com/miekg/dns v1.1.50
github.com/minio/minio-go/v7 v7.0.47 github.com/minio/minio-go/v7 v7.0.48
github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/mapstructure v1.5.0
github.com/oklog/ulid v1.3.1 github.com/oklog/ulid v1.3.1
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1

4
go.sum
View file

@ -436,8 +436,8 @@ github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.47 h1:sLiuCKGSIcn/MI6lREmTzX91DX/oRau4ia0j6e6eOSs= github.com/minio/minio-go/v7 v7.0.48 h1:VQtYB/2xHW2SlxqhjRlDpvSiSOfGlyFlXZF1EHARPHM=
github.com/minio/minio-go/v7 v7.0.47/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw= github.com/minio/minio-go/v7 v7.0.48/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw=
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=

View file

@ -2,4 +2,5 @@
*.test *.test
validator validator
golangci-lint golangci-lint
functional_tests functional_tests
.idea

View file

@ -23,8 +23,6 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"net/url"
"strconv"
"sync" "sync"
"github.com/minio/minio-go/v7/pkg/s3utils" "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 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. // Execute GET on objectName.
resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
bucketName: bucketName, bucketName: bucketName,
objectName: objectName, objectName: objectName,
queryValues: urlValues, queryValues: opts.toQueryValues(),
customHeader: opts.Header(), customHeader: opts.Header(),
contentSHA256Hex: emptySHA256Hex, contentSHA256Hex: emptySHA256Hex,
}) })

View file

@ -20,6 +20,8 @@ package minio
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"strconv"
"time" "time"
"github.com/minio/minio-go/v7/pkg/encrypt" "github.com/minio/minio-go/v7/pkg/encrypt"
@ -36,6 +38,7 @@ type AdvancedGetOptions struct {
// during GET requests. // during GET requests.
type GetObjectOptions struct { type GetObjectOptions struct {
headers map[string]string headers map[string]string
reqParams url.Values
ServerSideEncryption encrypt.ServerSide ServerSideEncryption encrypt.ServerSide
VersionID string VersionID string
PartNumber int PartNumber int
@ -83,6 +86,34 @@ func (o *GetObjectOptions) Set(key, value string) {
o.headers[http.CanonicalHeaderKey(key)] = value 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. // SetMatchETag - set match etag.
func (o *GetObjectOptions) SetMatchETag(etag string) error { func (o *GetObjectOptions) SetMatchETag(etag string) error {
if etag == "" { if etag == "" {
@ -149,3 +180,24 @@ func (o *GetObjectOptions) SetRange(start, end int64) error {
} }
return nil 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
}

View file

@ -500,8 +500,6 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
// CRC32C is ~50% faster on AMD64 @ 30GB/s // CRC32C is ~50% faster on AMD64 @ 30GB/s
var crcBytes []byte var crcBytes []byte
crc := crc32.New(crc32.MakeTable(crc32.Castagnoli)) 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. // Total data read and written to server. should be equal to 'size' at the end of the call.
var totalUploadedSize int64 var totalUploadedSize int64
@ -569,9 +567,10 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
var md5Base64 string var md5Base64 string
if opts.SendContentMd5 { if opts.SendContentMd5 {
md5Hash.Reset() md5Hash := c.md5Hasher()
md5Hash.Write(buf[:length]) md5Hash.Write(buf[:length])
md5Base64 = base64.StdEncoding.EncodeToString(md5Hash.Sum(nil)) md5Base64 = base64.StdEncoding.EncodeToString(md5Hash.Sum(nil))
md5Hash.Close()
} }
defer wg.Done() defer wg.Done()
@ -590,6 +589,7 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
objPart, uerr := c.uploadPart(ctx, p) objPart, uerr := c.uploadPart(ctx, p)
if uerr != nil { if uerr != nil {
errCh <- uerr errCh <- uerr
return
} }
// Save successfully uploaded part metadata. // Save successfully uploaded part metadata.

View file

@ -59,6 +59,7 @@ type SnowballObject struct {
Size int64 Size int64
// Modtime to apply to the object. // Modtime to apply to the object.
// If Modtime is the zero value current time will be used.
ModTime time.Time ModTime time.Time
// Content of the object. // Content of the object.
@ -172,6 +173,10 @@ objectLoop:
ModTime: obj.ModTime, ModTime: obj.ModTime,
Format: tar.FormatPAX, Format: tar.FormatPAX,
} }
if header.ModTime.IsZero() {
header.ModTime = time.Now().UTC()
}
if err := t.WriteHeader(&header); err != nil { if err := t.WriteHeader(&header); err != nil {
closeObj() closeObj()
return err return err

View file

@ -118,7 +118,7 @@ type Options struct {
// Global constants. // Global constants.
const ( const (
libraryName = "minio-go" libraryName = "minio-go"
libraryVersion = "v7.0.47" libraryVersion = "v7.0.48"
) )
// User Agent should always following the below style. // User Agent should always following the below style.

View file

@ -140,6 +140,9 @@ func (i *STSCertificateIdentity) Retrieve() (Value, error) {
if err != nil { if err != nil {
return Value{}, err return Value{}, err
} }
if req.Form == nil {
req.Form = url.Values{}
}
req.Form.Add("DurationSeconds", strconv.FormatUint(uint64(livetime.Seconds()), 10)) req.Form.Add("DurationSeconds", strconv.FormatUint(uint64(livetime.Seconds()), 10))
resp, err := i.Client.Do(req) resp, err := i.Client.Do(req)

View file

@ -48,6 +48,7 @@ var awsS3EndpointMap = map[string]string{
"cn-north-1": "s3.dualstack.cn-north-1.amazonaws.com.cn", "cn-north-1": "s3.dualstack.cn-north-1.amazonaws.com.cn",
"cn-northwest-1": "s3.dualstack.cn-northwest-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-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. // getS3Endpoint get Amazon S3 endpoint based on the bucket location.

View file

@ -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-") 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 ( var (
md5Pool = sync.Pool{New: func() interface{} { return md5.New() }} md5Pool = sync.Pool{New: func() interface{} { return md5.New() }}
sha256Pool = sync.Pool{New: func() interface{} { return sha256.New() }} sha256Pool = sync.Pool{New: func() interface{} { return sha256.New() }}

2
vendor/modules.txt vendored
View file

@ -329,7 +329,7 @@ github.com/miekg/dns
# github.com/minio/md5-simd v1.1.2 # github.com/minio/md5-simd v1.1.2
## explicit; go 1.14 ## explicit; go 1.14
github.com/minio/md5-simd github.com/minio/md5-simd
# github.com/minio/minio-go/v7 v7.0.47 # github.com/minio/minio-go/v7 v7.0.48
## explicit; go 1.17 ## explicit; go 1.17
github.com/minio/minio-go/v7 github.com/minio/minio-go/v7
github.com/minio/minio-go/v7/pkg/credentials github.com/minio/minio-go/v7/pkg/credentials