Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: minio/minio-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.0.73
Choose a base ref
...
head repository: minio/minio-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.0.74
Choose a head ref
  • 6 commits
  • 9 files changed
  • 5 contributors

Commits on Jul 2, 2024

  1. Update version to next release

    minio-trusted committed Jul 2, 2024
    Copy the full SHA
    1ff6b60 View commit details
  2. return appropriate error type for generic handling (#1981)

    harshavardhana authored Jul 2, 2024
    Copy the full SHA
    77fb078 View commit details
  3. update govulncheck to 1.22.5

    harshavardhana committed Jul 2, 2024
    Copy the full SHA
    4742469 View commit details

Commits on Jul 3, 2024

  1. feat: add SetContentDisposition method for postPolicy Upload (#1982)

    lianggx6 authored Jul 3, 2024
    Copy the full SHA
    66ba593 View commit details

Commits on Jul 8, 2024

  1. docs: fix doc about default alias (#1984)

    emil2k authored Jul 8, 2024
    Copy the full SHA
    6c2c69f View commit details

Commits on Jul 15, 2024

  1. fix: GCS endpoint validation to allow ports (#1985)

    ammarhusain-sol authored Jul 15, 2024
    Copy the full SHA
    a428198 View commit details
Showing with 54 additions and 11 deletions.
  1. +1 −1 .github/workflows/vulncheck.yml
  2. +20 −4 api-get-object.go
  3. +10 −2 api-stat.go
  4. +1 −1 api.go
  5. +1 −1 pkg/credentials/file_minio_client.go
  6. +1 −1 pkg/s3utils/utils.go
  7. +2 −0 pkg/s3utils/utils_test.go
  8. +17 −0 post-policy.go
  9. +1 −1 utils_test.go
2 changes: 1 addition & 1 deletion .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.22.x ]
go-version: [ 1.22.5 ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
24 changes: 20 additions & 4 deletions api-get-object.go
Original file line number Diff line number Diff line change
@@ -32,10 +32,18 @@ import (
func (c *Client) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return nil, err
return nil, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "InvalidBucketName",
Message: err.Error(),
}
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return nil, err
return nil, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "XMinioInvalidObjectName",
Message: err.Error(),
}
}

gctx, cancel := context.WithCancel(ctx)
@@ -649,10 +657,18 @@ func newObject(ctx context.Context, cancel context.CancelFunc, reqCh chan<- getR
func (c *Client) getObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error) {
// Validate input arguments.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return nil, ObjectInfo{}, nil, err
return nil, ObjectInfo{}, nil, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "InvalidBucketName",
Message: err.Error(),
}
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return nil, ObjectInfo{}, nil, err
return nil, ObjectInfo{}, nil, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "XMinioInvalidObjectName",
Message: err.Error(),
}
}

// Execute GET on objectName.
12 changes: 10 additions & 2 deletions api-stat.go
Original file line number Diff line number Diff line change
@@ -61,10 +61,18 @@ func (c *Client) BucketExists(ctx context.Context, bucketName string) (bool, err
func (c *Client) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectInfo{}, err
return ObjectInfo{}, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "InvalidBucketName",
Message: err.Error(),
}
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return ObjectInfo{}, err
return ObjectInfo{}, ErrorResponse{
StatusCode: http.StatusBadRequest,
Code: "XMinioInvalidObjectName",
Message: err.Error(),
}
}
headers := opts.Header()
if opts.Internal.ReplicationDeleteMarker {
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ type Options struct {
// Global constants.
const (
libraryName = "minio-go"
libraryVersion = "v7.0.73"
libraryVersion = "v7.0.74"
)

// User Agent should always following the below style.
2 changes: 1 addition & 1 deletion pkg/credentials/file_minio_client.go
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ type FileMinioClient struct {
Filename string

// MinIO Alias to extract credentials from the shared credentials file. If empty
// will default to environment variable "MINIO_ALIAS" or "default" if
// will default to environment variable "MINIO_ALIAS" or "s3" if
// environment variable is also not set.
Alias string

2 changes: 1 addition & 1 deletion pkg/s3utils/utils.go
Original file line number Diff line number Diff line change
@@ -226,7 +226,7 @@ func IsGoogleEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
return false
}
return endpointURL.Host == "storage.googleapis.com"
return endpointURL.Hostname() == "storage.googleapis.com"
}

// Expects ascii encoded strings - from output of urlEncodePath
2 changes: 2 additions & 0 deletions pkg/s3utils/utils_test.go
Original file line number Diff line number Diff line change
@@ -284,6 +284,8 @@ func TestIsGoogleEndpoint(t *testing.T) {
// valid inputs.
{"http://storage.googleapis.com", true},
{"https://storage.googleapis.com", true},
{"http://storage.googleapis.com:80", true},
{"https://storage.googleapis.com:443", true},
}

for i, testCase := range testCases {
17 changes: 17 additions & 0 deletions post-policy.go
Original file line number Diff line number Diff line change
@@ -209,6 +209,23 @@ func (p *PostPolicy) SetContentTypeStartsWith(contentTypeStartsWith string) erro
return nil
}

// SetContentDisposition - Sets content-disposition of the object for this policy
func (p *PostPolicy) SetContentDisposition(contentDisposition string) error {
if strings.TrimSpace(contentDisposition) == "" || contentDisposition == "" {
return errInvalidArgument("No content disposition specified.")
}
policyCond := policyCondition{
matchType: "eq",
condition: "$Content-Disposition",
value: contentDisposition,
}
if err := p.addNewPolicy(policyCond); err != nil {
return err
}
p.formData["Content-Disposition"] = contentDisposition
return nil
}

// SetContentLengthRange - Set new min and max content length
// condition for all incoming uploads.
func (p *PostPolicy) SetContentLengthRange(min, max int64) error {
2 changes: 1 addition & 1 deletion utils_test.go
Original file line number Diff line number Diff line change
@@ -114,6 +114,7 @@ func TestGetEndpointURL(t *testing.T) {
{"192.168.1.1:9000", false, "http://192.168.1.1:9000", nil, true},
{"192.168.1.1:9000", true, "https://192.168.1.1:9000", nil, true},
{"s3.amazonaws.com:443", true, "https://s3.amazonaws.com:443", nil, true},
{"storage.googleapis.com:443", true, "https://storage.googleapis.com:443", nil, true},
{"[::1]", false, "http://[::1]", nil, true},
{"[::1]", true, "https://[::1]", nil, true},
{"[::1]:80", false, "http://[::1]:80", nil, true},
@@ -122,7 +123,6 @@ func TestGetEndpointURL(t *testing.T) {
{"[::1]:9000", true, "https://[::1]:9000", nil, true},
{"13333.123123.-", true, "", errInvalidArgument(fmt.Sprintf("Endpoint: %s does not follow ip address or domain name standards.", "13333.123123.-")), false},
{"13333.123123.-", true, "", errInvalidArgument(fmt.Sprintf("Endpoint: %s does not follow ip address or domain name standards.", "13333.123123.-")), false},
{"storage.googleapis.com:4000", true, "", errInvalidArgument("Google Cloud Storage endpoint should be 'storage.googleapis.com'."), false},
{"s3.aamzza.-", true, "", errInvalidArgument(fmt.Sprintf("Endpoint: %s does not follow ip address or domain name standards.", "s3.aamzza.-")), false},
{"", true, "", errInvalidArgument("Endpoint: does not follow ip address or domain name standards."), false},
}