From ee015f72d9ab494f8b4b677b3c1401fe2668345a Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 18 Mar 2024 09:05:35 +0100 Subject: [PATCH] Add missing returns Signed-off-by: Christian Richter --- changelog/unreleased/check-parent-on-copy.md | 1 + internal/http/services/owncloud/ocdav/copy.go | 4 ++++ internal/http/services/owncloud/ocdav/move.go | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog/unreleased/check-parent-on-copy.md b/changelog/unreleased/check-parent-on-copy.md index fbddf9a7c4..c9bad2397d 100644 --- a/changelog/unreleased/check-parent-on-copy.md +++ b/changelog/unreleased/check-parent-on-copy.md @@ -2,5 +2,6 @@ Bugfix: Prevent copying a file to a parent folder When copying a file to a parent folder, the file would be copied to the parent folder, but the file would not be removed from the original folder. +https://github.com/cs3org/reva/pull/4582 https://github.com/cs3org/reva/pull/4571 https://github.com/owncloud/ocis/issues/1230 \ No newline at end of file diff --git a/internal/http/services/owncloud/ocdav/copy.go b/internal/http/services/owncloud/ocdav/copy.go index 6ef60181a2..e4bfff0d94 100644 --- a/internal/http/services/owncloud/ocdav/copy.go +++ b/internal/http/services/owncloud/ocdav/copy.go @@ -562,12 +562,16 @@ func (s *svc) prepareCopy(ctx context.Context, w http.ResponseWriter, r *http.Re isParent, err := s.referenceIsChildOf(ctx, s.gatewaySelector, srcRef, dstRef) if err != nil { switch err.(type) { + case errtypes.IsNotFound: + isParent = false case errtypes.IsNotSupported: log.Error().Err(err).Msg("can not detect recursive copy operation. missing machine auth configuration?") w.WriteHeader(http.StatusForbidden) + return nil default: log.Error().Err(err).Msg("error while trying to detect recursive copy operation") w.WriteHeader(http.StatusInternalServerError) + return nil } } diff --git a/internal/http/services/owncloud/ocdav/move.go b/internal/http/services/owncloud/ocdav/move.go index 6b55885e5a..6d1a523bef 100644 --- a/internal/http/services/owncloud/ocdav/move.go +++ b/internal/http/services/owncloud/ocdav/move.go @@ -166,15 +166,16 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req if err != nil { switch err.(type) { case errtypes.IsNotFound: - w.WriteHeader(http.StatusNotFound) + isParent = false case errtypes.IsNotSupported: log.Error().Err(err).Msg("can not detect recursive move operation. missing machine auth configuration?") w.WriteHeader(http.StatusForbidden) + return default: log.Error().Err(err).Msg("error while trying to detect recursive move operation") w.WriteHeader(http.StatusInternalServerError) + return } - return } if isParent { w.WriteHeader(http.StatusConflict)