From 88cce13bbaa57b76730ee91398283e030cff6883 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 14 Jan 2022 17:38:27 +0100 Subject: [PATCH] policy: Removing a bucket policy should return an error (#1609) Currently removing a policy from bucket does not return an error for any error, such as AccessDenied. This commit fixes this behavior. --- api-bucket-policy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api-bucket-policy.go b/api-bucket-policy.go index 57cdbc6e3..e7edf9c97 100644 --- a/api-bucket-policy.go +++ b/api-bucket-policy.go @@ -87,6 +87,11 @@ func (c *Client) removeBucketPolicy(ctx context.Context, bucketName string) erro if err != nil { return err } + + if resp.StatusCode != http.StatusNoContent { + return httpRespToErrorResponse(resp, bucketName, "") + } + return nil }