Skip to content

Commit

Permalink
acl: Fix GetObjectACL xml parsing (#1598)
Browse files Browse the repository at this point in the history
A recent change introduced a regression in parsing Object ACL S3 API.

This issue is not detected by minio-go functional tests since CI only
runs it against MinIO where Object ACL is unsupported.

Fix the regression and allow short testing of ObjectACL since MinIO
supports a small subset of the spec.
  • Loading branch information
vadmeste committed Dec 10, 2021
1 parent 0ccc723 commit a6967e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 3 additions & 2 deletions api-get-object-acl.go
Expand Up @@ -47,8 +47,9 @@ type AccessControlList struct {
}

type accessControlPolicy struct {
Owner
AccessControlList
XMLName xml.Name `xml:"AccessControlPolicy"`
Owner Owner
AccessControlList AccessControlList
}

// GetObjectACL get object ACLs
Expand Down
18 changes: 12 additions & 6 deletions functional_tests.go
Expand Up @@ -11430,12 +11430,6 @@ func testGetObjectACLContext() {
// Seed random based on current time.
rand.Seed(time.Now().Unix())

// skipping region functional tests for non s3 runs
if os.Getenv(serverEndpoint) != "s3.amazonaws.com" {
ignoredLog(testName, function, args, startTime, "Skipped region functional tests for non s3 runs").Info()
return
}

// Instantiate new minio client object.
c, err := minio.New(os.Getenv(serverEndpoint),
&minio.Options{
Expand Down Expand Up @@ -11512,6 +11506,17 @@ func testGetObjectACLContext() {
return
}

// Do a very limited testing if this is not AWS S3
if os.Getenv(serverEndpoint) != "s3.amazonaws.com" {
if s[0] != "private" {
logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"private\" but got"+fmt.Sprintf("%q", s[0]), nil)
return
}

successLogger(testName, function, args, startTime).Info()
return
}

if s[0] != "public-read-write" {
logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"public-read-write\" but got"+fmt.Sprintf("%q", s[0]), nil)
return
Expand Down Expand Up @@ -12111,6 +12116,7 @@ func main() {
// Default to KMS tests.
kms = true
}

// execute tests
if isFullMode() {
testMakeBucketErrorV2()
Expand Down

0 comments on commit a6967e7

Please sign in to comment.