[#531] Fix the error codes when checking the ACL format
All checks were successful
/ DCO (pull_request) Successful in 3m23s
/ Vulncheck (pull_request) Successful in 4m30s
/ Builds (pull_request) Successful in 5m21s
/ Lint (pull_request) Successful in 5m15s
/ Tests (pull_request) Successful in 4m58s
/ OCI image (pull_request) Successful in 5m25s
/ Vulncheck (push) Successful in 4m20s
/ Builds (push) Successful in 4m36s
/ OCI image (push) Successful in 5m8s
/ Lint (push) Successful in 5m11s
/ Tests (push) Successful in 4m56s

Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
This commit is contained in:
Aleksey Kravchenko 2024-12-25 20:46:42 +03:00
parent a725c68d06
commit e060308318
2 changed files with 8 additions and 1 deletions

View file

@ -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",

View file

@ -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) {