diff --git a/cmd/admin-handler-utils.go b/cmd/admin-handler-utils.go index a6658468a..2cdc5cfa2 100644 --- a/cmd/admin-handler-utils.go +++ b/cmd/admin-handler-utils.go @@ -180,7 +180,7 @@ func toAdminAPIErr(ctx context.Context, err error) APIError { apiErr = APIError{ Code: "XMinioAdminTierBackendInUse", Description: err.Error(), - HTTPStatusCode: http.StatusConflict, + HTTPStatusCode: http.StatusBadRequest, } case errors.Is(err, errTierBackendNotEmpty): apiErr = APIError{ diff --git a/cmd/api-errors.go b/cmd/api-errors.go index 638cac996..e01333207 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -901,7 +901,7 @@ var errorCodes = errorCodeMap{ ErrReplicationDenyEditError: { Code: "XMinioReplicationDenyEdit", Description: "Cannot alter local replication config since this server is in a cluster replication setup", - HTTPStatusCode: http.StatusConflict, + HTTPStatusCode: http.StatusBadRequest, }, ErrBucketRemoteIdenticalToSource: { Code: "XMinioAdminRemoteIdenticalToSource", @@ -1167,7 +1167,7 @@ var errorCodes = errorCodeMap{ ErrObjectExistsAsDirectory: { Code: "XMinioObjectExistsAsDirectory", Description: "Object name already exists as a directory.", - HTTPStatusCode: http.StatusConflict, + HTTPStatusCode: http.StatusBadRequest, }, ErrInvalidObjectName: { Code: "XMinioInvalidObjectName", diff --git a/cmd/bucket-versioning-handler.go b/cmd/bucket-versioning-handler.go index 7e96b3a79..68d15fad0 100644 --- a/cmd/bucket-versioning-handler.go +++ b/cmd/bucket-versioning-handler.go @@ -68,8 +68,8 @@ func (api objectAPIHandlers) PutBucketVersioningHandler(w http.ResponseWriter, r if globalSiteReplicationSys.isEnabled() && !v.Enabled() { writeErrorResponse(ctx, w, APIError{ Code: "InvalidBucketState", - Description: "Cluster replication is enabled for this site, so the versioning cannot be suspended.", - HTTPStatusCode: http.StatusConflict, + Description: "Cluster replication is enabled on this site, versioning cannot be suspended on bucket.", + HTTPStatusCode: http.StatusBadRequest, }, r.URL) return } @@ -77,16 +77,16 @@ func (api objectAPIHandlers) PutBucketVersioningHandler(w http.ResponseWriter, r if rcfg, _ := globalBucketObjectLockSys.Get(bucket); rcfg.LockEnabled && (v.Suspended() || v.PrefixesExcluded()) { writeErrorResponse(ctx, w, APIError{ Code: "InvalidBucketState", - Description: "An Object Lock configuration is present on this bucket, so the versioning state cannot be changed.", - HTTPStatusCode: http.StatusConflict, + Description: "An Object Lock configuration is present on this bucket, versioning cannot be suspended.", + HTTPStatusCode: http.StatusBadRequest, }, r.URL) return } if _, err := getReplicationConfig(ctx, bucket); err == nil && v.Suspended() { writeErrorResponse(ctx, w, APIError{ Code: "InvalidBucketState", - Description: "A replication configuration is present on this bucket, so the versioning state cannot be changed.", - HTTPStatusCode: http.StatusConflict, + Description: "A replication configuration is present on this bucket, bucket wide versioning cannot be suspended.", + HTTPStatusCode: http.StatusBadRequest, }, r.URL) return }