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

Do not panic #4283

Merged
merged 2 commits into from
Oct 25, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Prevent panic when trying to move a non-existent file

We fixed a panic when the user tried to move a file which does not exist.

https://github.com/cs3org/reva/pull/4283
2 changes: 2 additions & 0 deletions internal/http/services/owncloud/ocdav/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req
isChild, err := s.referenceIsChildOf(ctx, s.gatewaySelector, dst, src)
if err != nil {
switch err.(type) {
case errtypes.IsNotFound:
w.WriteHeader(http.StatusNotFound)
case errtypes.IsNotSupported:
log.Error().Err(err).Msg("can not detect recursive move operation. missing machine auth configuration?")
w.WriteHeader(http.StatusForbidden)
Expand Down
3 changes: 3 additions & 0 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ func (s *svc) sspReferenceIsChildOf(ctx context.Context, selector pool.Selectabl
if err != nil {
return false, err
}
if parentStatRes.Status.Code != rpc.Code_CODE_OK {
return false, errtypes.NewErrtypeFromStatus(parentStatRes.Status)
}
parentAuthCtx, err := authContextForUser(client, parentStatRes.Info.Owner, s.c.MachineAuthAPIKey)
if err != nil {
return false, err
Expand Down