diff --git a/api/errors/errors.go b/api/errors/errors.go index 7ce7c5fe..2e033a53 100644 --- a/api/errors/errors.go +++ b/api/errors/errors.go @@ -57,6 +57,7 @@ const ( ErrInvalidCopyDest ErrInvalidPolicyDocument ErrInvalidObjectState + ErrMalformedACL ErrMalformedXML ErrMissingContentLength ErrMissingContentMD5 @@ -456,6 +457,12 @@ var errorCodes = errorCodeMap{ Description: "The requested range is not satisfiable", HTTPStatusCode: http.StatusRequestedRangeNotSatisfiable, }, + ErrMalformedACL: { + ErrCode: ErrMalformedACL, + Code: "MalformedACLError", + Description: "The ACL that you provided was not well formed or did not validate against our published schema.", + HTTPStatusCode: http.StatusBadRequest, + }, ErrMalformedXML: { ErrCode: ErrMalformedXML, Code: "MalformedXML", diff --git a/api/handler/put.go b/api/handler/put.go index 9775de52..c3776f79 100644 --- a/api/handler/put.go +++ b/api/handler/put.go @@ -744,7 +744,7 @@ func parseCannedACL(header http.Header) (string, error) { return acl, nil } - return "", fmt.Errorf("unknown acl: %s", acl) + return "", apierr.GetAPIErrorWithError(apierr.ErrMalformedACL, fmt.Errorf("unknown acl: %s", acl)) } func (h *handler) CreateBucketHandler(w http.ResponseWriter, r *http.Request) {