diff --git a/changelog/unreleased/423-on-tag-create.md b/changelog/unreleased/423-on-tag-create.md new file mode 100644 index 000000000..bb020bcd8 --- /dev/null +++ b/changelog/unreleased/423-on-tag-create.md @@ -0,0 +1,5 @@ +Bugfix: Return 423 status code on tag create + +When a file is locked, return 423 status code instead 500 on tag create + +https://github.com/owncloud/ocis/pull/7596 diff --git a/services/graph/pkg/service/v0/tags.go b/services/graph/pkg/service/v0/tags.go index 24850296b..594daaf64 100644 --- a/services/graph/pkg/service/v0/tags.go +++ b/services/graph/pkg/service/v0/tags.go @@ -120,7 +120,11 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) { }, }) if err != nil || resp.GetStatus().GetCode() != rpc.Code_CODE_OK { - g.logger.Error().Err(err).Msg("error setting tags") + g.logger.Error().Err(err).Interface("status", resp.GetStatus()).Msg("error setting tags") + if resp.GetStatus().GetCode() == rpc.Code_CODE_LOCKED { + errorcode.InvalidRequest.Render(w, r, http.StatusLocked, "file is locked") + return + } w.WriteHeader(http.StatusInternalServerError) return }