return 423 on tag create when file is locked

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-10-26 16:07:50 +02:00
parent 6d2b3e3166
commit 6e510be180
2 changed files with 10 additions and 1 deletions
@@ -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
+5 -1
View File
@@ -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
}