Skip to content

Commit

Permalink
Add missing returns
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Richter <crichter@owncloud.com>
  • Loading branch information
dragonchaser committed Mar 18, 2024
1 parent ad43b97 commit d38d3f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit d38d3f2

Please sign in to comment.