Skip to content

Commit

Permalink
Merge pull request #4964 from aduffeck/debug-wopi-500
Browse files Browse the repository at this point in the history
Handle permission denied errors when touching the new file
  • Loading branch information
butonic authored Nov 20, 2024
2 parents 4f31fd9 + 336e871 commit 931da98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-approvider-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix a wrong error code when approvider creates a new file

We fixed a problem where the approvider would return a 500 error instead of 403 when trying to create a new file in a read-only share.

https://github.com/cs3org/reva/pull/4964
4 changes: 4 additions & 0 deletions internal/http/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ func (s *svc) handleNew(w http.ResponseWriter, r *http.Request) {
}

if touchRes.Status.Code != rpc.Code_CODE_OK {
if touchRes.Status.Code == rpc.Code_CODE_PERMISSION_DENIED {
writeError(w, r, appErrorPermissionDenied, "permission denied to create the file", nil)
return
}
writeError(w, r, appErrorServerError, "touching the file failed", nil)
return
}
Expand Down

0 comments on commit 931da98

Please sign in to comment.