diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 35373fde952..fb19b1373de 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -807,7 +807,7 @@ func (s *service) ListRecycleStream(req *provider.ListRecycleStreamRequest, ss p var st *rpc.Status switch err.(type) { case errtypes.IsNotFound: - st = status.NewNotFound(ctx, "path not found when listing recycle stream") + st = status.NewNotFound(ctx, "resource not found when listing recycle stream") case errtypes.PermissionDenied: st = status.NewPermissionDenied(ctx, err, "permission denied") default: @@ -853,7 +853,7 @@ func (s *service) ListRecycle(ctx context.Context, req *provider.ListRecycleRequ var st *rpc.Status switch err.(type) { case errtypes.IsNotFound: - st = status.NewNotFound(ctx, "path not found when listing recycle") + st = status.NewNotFound(ctx, "resource not found when listing recycle") case errtypes.PermissionDenied: st = status.NewPermissionDenied(ctx, err, "permission denied") default: diff --git a/internal/http/services/owncloud/ocdav/trashbin.go b/internal/http/services/owncloud/ocdav/trashbin.go index 622b59b370a..aa5d31968f4 100644 --- a/internal/http/services/owncloud/ocdav/trashbin.go +++ b/internal/http/services/owncloud/ocdav/trashbin.go @@ -40,6 +40,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" + rstatus "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/rhttp/router" "github.com/cs3org/reva/v2/pkg/utils" ) @@ -124,7 +125,10 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler { w.WriteHeader(http.StatusInternalServerError) return case rpcstatus.Code != rpc.Code_CODE_OK: - errors.HandleErrorStatus(log, w, rpcstatus) + httpStatus := rstatus.HTTPStatusFromCode(rpcstatus.Code) + w.WriteHeader(httpStatus) + b, err := errors.Marshal(httpStatus, rpcstatus.Message, "") + errors.HandleWebdavError(log, w, b, err) return } ref := spacelookup.MakeRelativeReference(space, ".", false) @@ -161,7 +165,10 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler { return } if rpcstatus.Code != rpc.Code_CODE_OK { - errors.HandleErrorStatus(log, w, rpcstatus) + httpStatus := rstatus.HTTPStatusFromCode(rpcstatus.Code) + w.WriteHeader(httpStatus) + b, err := errors.Marshal(httpStatus, rpcstatus.Message, "") + errors.HandleWebdavError(log, w, b, err) return } dstRef := spacelookup.MakeRelativeReference(space, p, false) @@ -232,7 +239,10 @@ func (h *TrashbinHandler) listTrashbin(w http.ResponseWriter, r *http.Request, s } if getRecycleRes.Status.Code != rpc.Code_CODE_OK { - errors.HandleErrorStatus(&sublog, w, getRecycleRes.Status) + httpStatus := rstatus.HTTPStatusFromCode(getRecycleRes.Status.Code) + w.WriteHeader(httpStatus) + b, err := errors.Marshal(httpStatus, getRecycleRes.Status.Message, "") + errors.HandleWebdavError(&sublog, w, b, err) return } @@ -259,7 +269,10 @@ func (h *TrashbinHandler) listTrashbin(w http.ResponseWriter, r *http.Request, s } if getRecycleRes.Status.Code != rpc.Code_CODE_OK { - errors.HandleErrorStatus(&sublog, w, getRecycleRes.Status) + httpStatus := rstatus.HTTPStatusFromCode(getRecycleRes.Status.Code) + w.WriteHeader(httpStatus) + b, err := errors.Marshal(httpStatus, getRecycleRes.Status.Message, "") + errors.HandleWebdavError(&sublog, w, b, err) return } items = append(items, getRecycleRes.RecycleItems...) diff --git a/tests/acceptance/expected-failures-on-OCIS-storage.md b/tests/acceptance/expected-failures-on-OCIS-storage.md index 32daf99c379..d8bf310933c 100644 --- a/tests/acceptance/expected-failures-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-on-OCIS-storage.md @@ -472,7 +472,6 @@ _ocdav: api compatibility, return correct status code_ - [apiAuthWebDav/webDavPOSTAuth.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavPOSTAuth.feature#L67) Scenario: send POST requests to another user's webDav endpoints as normal user using the spaces WebDAV API #### [Using double slash in URL to access a folder gives 501 and other status codes](https://github.com/owncloud/ocis/issues/1667) -- [apiAuthWebDav/webDavSpecialURLs.feature:24](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L24) - [apiAuthWebDav/webDavSpecialURLs.feature:121](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L121) - [apiAuthWebDav/webDavSpecialURLs.feature:132](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L132) - [apiAuthWebDav/webDavSpecialURLs.feature:163](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L163) diff --git a/tests/acceptance/expected-failures-on-S3NG-storage.md b/tests/acceptance/expected-failures-on-S3NG-storage.md index b4ef156e565..5e6b2fe5f70 100644 --- a/tests/acceptance/expected-failures-on-S3NG-storage.md +++ b/tests/acceptance/expected-failures-on-S3NG-storage.md @@ -480,7 +480,6 @@ _ocdav: api compatibility, return correct status code_ - [apiAuthWebDav/webDavPOSTAuth.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavPOSTAuth.feature#L67) Scenario: send POST requests to another user's webDav endpoints as normal user using the spaces WebDAV API #### [Using double slash in URL to access a folder gives 501 and other status codes](https://github.com/owncloud/ocis/issues/1667) -- [apiAuthWebDav/webDavSpecialURLs.feature:24](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L24) - [apiAuthWebDav/webDavSpecialURLs.feature:121](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L121) - [apiAuthWebDav/webDavSpecialURLs.feature:132](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L132) - [apiAuthWebDav/webDavSpecialURLs.feature:163](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiAuthWebDav/webDavSpecialURLs.feature#L163)