Skip to content

Commit

Permalink
Return correct error on invalid grantee type (#926)
Browse files Browse the repository at this point in the history
Closes #908.
  • Loading branch information
roman-khimov authored Feb 8, 2024
2 parents aef5732 + 205f942 commit bdb5e35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/handler/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func addGrantees(list []*Grant, headers http.Header, hdr string) ([]*Grant, erro

for _, grantee := range grantees {
if grantee.Type == granteeAmazonCustomerByEmail || (grantee.Type == granteeGroup && grantee.URI != allUsersGroup) {
return nil, stderrors.New("unsupported grantee type")
return nil, s3errors.GetAPIError(s3errors.ErrNotSupported)
}

list = append(list, &Grant{
Expand Down Expand Up @@ -1186,7 +1186,7 @@ func aclToAst(acl *AccessControlPolicy, resInfo *resourceInfo) (*ast, error) {

for _, grant := range acl.AccessControlList {
if grant.Grantee.Type == granteeAmazonCustomerByEmail || (grant.Grantee.Type == granteeGroup && grant.Grantee.URI != allUsersGroup) {
return nil, stderrors.New("unsupported grantee type")
return nil, s3errors.GetAPIError(s3errors.ErrNotSupported)
}

var groupGrantee bool
Expand Down Expand Up @@ -1225,7 +1225,7 @@ func aclToPolicy(acl *AccessControlPolicy, resInfo *resourceInfo) (*bucketPolicy

for _, grant := range acl.AccessControlList {
if grant.Grantee.Type == granteeAmazonCustomerByEmail || (grant.Grantee.Type == granteeGroup && grant.Grantee.URI != allUsersGroup) {
return nil, stderrors.New("unsupported grantee type")
return nil, s3errors.GetAPIError(s3errors.ErrNotSupported)
}

user := grant.Grantee.ID
Expand Down

0 comments on commit bdb5e35

Please sign in to comment.