Skip to content

Commit

Permalink
adapt some return values
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Apr 3, 2023
1 parent 0a947d0 commit 66e2432
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .drone.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The test runner source for API tests
APITESTS_COMMITID=f4ae082265c54013f28e7facb892d6fdc943e827
APITESTS_COMMITID=56357be5f2a6d36b342e3de5dc84ff13e454b40c
APITESTS_BRANCH=dont-share-versions
APITESTS_REPO_GIT_URL=https://github.com/owncloud/ocis.git
12 changes: 12 additions & 0 deletions internal/http/services/owncloud/ocdav/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request,
return
}
if lvRes.Status.Code != rpc.Code_CODE_OK {
if lvRes.Status.Code == rpc.Code_CODE_PERMISSION_DENIED {
w.WriteHeader(http.StatusForbidden)
b, err := errors.Marshal(http.StatusForbidden, "You have no permission to list file versions on this resource", "")
errors.HandleWebdavError(&sublog, w, b, err)
return
}
errors.HandleErrorStatus(&sublog, w, lvRes.Status)
return
}
Expand Down Expand Up @@ -226,6 +232,12 @@ func (h *VersionsHandler) doRestore(w http.ResponseWriter, r *http.Request, s *s
return
}
if res.Status.Code != rpc.Code_CODE_OK {
if res.Status.Code == rpc.Code_CODE_PERMISSION_DENIED {
w.WriteHeader(http.StatusForbidden)
b, err := errors.Marshal(http.StatusForbidden, "You have no permission to restore versions on this resource", "")
errors.HandleWebdavError(&sublog, w, b, err)
return
}
errors.HandleErrorStatus(&sublog, w, res.Status)
return
}
Expand Down

0 comments on commit 66e2432

Please sign in to comment.