Skip to content

Commit a6967e7

Browse files
authored
acl: Fix GetObjectACL xml parsing (#1598)
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.
1 parent 0ccc723 commit a6967e7

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

api-get-object-acl.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ type AccessControlList struct {
4747
}
4848

4949
type accessControlPolicy struct {
50-
Owner
51-
AccessControlList
50+
XMLName xml.Name `xml:"AccessControlPolicy"`
51+
Owner Owner
52+
AccessControlList AccessControlList
5253
}
5354

5455
// GetObjectACL get object ACLs

functional_tests.go

+12-6
Original file line numberDiff line numberDiff line change
@@ -11430,12 +11430,6 @@ func testGetObjectACLContext() {
1143011430
// Seed random based on current time.
1143111431
rand.Seed(time.Now().Unix())
1143211432

11433-
// skipping region functional tests for non s3 runs
11434-
if os.Getenv(serverEndpoint) != "s3.amazonaws.com" {
11435-
ignoredLog(testName, function, args, startTime, "Skipped region functional tests for non s3 runs").Info()
11436-
return
11437-
}
11438-
1143911433
// Instantiate new minio client object.
1144011434
c, err := minio.New(os.Getenv(serverEndpoint),
1144111435
&minio.Options{
@@ -11512,6 +11506,17 @@ func testGetObjectACLContext() {
1151211506
return
1151311507
}
1151411508

11509+
// Do a very limited testing if this is not AWS S3
11510+
if os.Getenv(serverEndpoint) != "s3.amazonaws.com" {
11511+
if s[0] != "private" {
11512+
logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"private\" but got"+fmt.Sprintf("%q", s[0]), nil)
11513+
return
11514+
}
11515+
11516+
successLogger(testName, function, args, startTime).Info()
11517+
return
11518+
}
11519+
1151511520
if s[0] != "public-read-write" {
1151611521
logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"public-read-write\" but got"+fmt.Sprintf("%q", s[0]), nil)
1151711522
return
@@ -12111,6 +12116,7 @@ func main() {
1211112116
// Default to KMS tests.
1211212117
kms = true
1211312118
}
12119+
1211412120
// execute tests
1211512121
if isFullMode() {
1211612122
testMakeBucketErrorV2()

0 commit comments

Comments
 (0)