Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing returns #4582

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/check-parent-on-copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions internal/http/services/owncloud/ocdav/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
5 changes: 3 additions & 2 deletions internal/http/services/owncloud/ocdav/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading