From 66e24325ae82f2f3d4bb5115061621c54622d232 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 8 Feb 2023 16:03:50 +0100 Subject: [PATCH] adapt some return values --- .drone.env | 2 +- internal/http/services/owncloud/ocdav/versions.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 489058a2d49..67c7eb02a90 100644 --- a/.drone.env +++ b/.drone.env @@ -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 diff --git a/internal/http/services/owncloud/ocdav/versions.go b/internal/http/services/owncloud/ocdav/versions.go index fa47d2f8da8..0eec232c079 100644 --- a/internal/http/services/owncloud/ocdav/versions.go +++ b/internal/http/services/owncloud/ocdav/versions.go @@ -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 } @@ -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 }