Skip to content

Commit

Permalink
Fix gateway delete with branch protection should return 200 with error (
Browse files Browse the repository at this point in the history
#7211)

* Fix gateway delete with branch protection should return 200 with error

Current implementation return no content status code after we render an
error.

* fix return after encode error
  • Loading branch information
nopcoder authored Jan 1, 2024
1 parent a811d2d commit b53e7a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/gateway/operations/deleteobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ func (controller *DeleteObject) Handle(w http.ResponseWriter, req *http.Request,
lg.WithError(err).Debug("could not delete object, it doesn't exist")
case errors.Is(err, graveler.ErrWriteToProtectedBranch):
_ = o.EncodeError(w, req, err, gatewayerrors.Codes.ToAPIErr(gatewayerrors.ErrWriteToProtectedBranch))
return
case errors.Is(err, graveler.ErrReadOnlyRepository):
_ = o.EncodeError(w, req, err, gatewayerrors.Codes.ToAPIErr(gatewayerrors.ErrReadOnlyRepository))
return
case err != nil:
lg.WithError(err).Error("could not delete object")
_ = o.EncodeError(w, req, err, gatewayerrors.Codes.ToAPIErr(gatewayerrors.ErrInternalError))
Expand Down

0 comments on commit b53e7a7

Please sign in to comment.