From c22b9d5d4db338506ed6adc0db648644bac37f36 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 31 May 2018 19:43:50 -0700 Subject: [PATCH] Fix s3cmd issue with ACL handling (#5999) With the implementation of dummy GET ACL handlers, tools like s3cmd perform few operations which causes the ACL call to be invoked. Make sure that in our router configuration GET?acl comes before actual GET call to facilitate this dummy call. --- cmd/acl-handlers.go | 8 ++++++-- cmd/api-router.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/acl-handlers.go b/cmd/acl-handlers.go index 8a67754a0..9f6ab9e92 100644 --- a/cmd/acl-handlers.go +++ b/cmd/acl-handlers.go @@ -82,7 +82,9 @@ func (api objectAPIHandlers) GetBucketACLHandler(w http.ResponseWriter, r *http. acl := &accessControlPolicy{} acl.AccessControlList.Grants = append(acl.AccessControlList.Grants, grant{ Grantee: grantee{ - Type: "CanonicalUser", + XMLNS: "http://www.w3.org/2001/XMLSchema-instance", + XMLXSI: "CanonicalUser", + Type: "CanonicalUser", }, Permission: "FULL_CONTROL", }) @@ -128,7 +130,9 @@ func (api objectAPIHandlers) GetObjectACLHandler(w http.ResponseWriter, r *http. acl := &accessControlPolicy{} acl.AccessControlList.Grants = append(acl.AccessControlList.Grants, grant{ Grantee: grantee{ - Type: "CanonicalUser", + XMLNS: "http://www.w3.org/2001/XMLSchema-instance", + XMLXSI: "CanonicalUser", + Type: "CanonicalUser", }, Permission: "FULL_CONTROL", }) diff --git a/cmd/api-router.go b/cmd/api-router.go index f7f80ef41..25f90ab47 100644 --- a/cmd/api-router.go +++ b/cmd/api-router.go @@ -69,6 +69,8 @@ func registerAPIRouter(router *mux.Router) { bucket.Methods("POST").Path("/{object:.+}").HandlerFunc(httpTraceAll(api.NewMultipartUploadHandler)).Queries("uploads", "") // AbortMultipartUpload bucket.Methods("DELETE").Path("/{object:.+}").HandlerFunc(httpTraceAll(api.AbortMultipartUploadHandler)).Queries("uploadId", "{uploadId:.*}") + // GetObjectACL - this is a dummy call. + bucket.Methods("GET").Path("/{object:.+}").HandlerFunc(httpTraceHdrs(api.GetObjectACLHandler)).Queries("acl", "") // GetObject bucket.Methods("GET").Path("/{object:.+}").HandlerFunc(httpTraceHdrs(api.GetObjectHandler)) // CopyObject