Skip to content

Commit

Permalink
Merge pull request cs3org#4432 from aduffeck/fix-meta-for-shares
Browse files Browse the repository at this point in the history
Fix /dav/meta for shares
  • Loading branch information
butonic authored Dec 22, 2023
2 parents e18e5ac + c86a4b9 commit 457e007
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-dav-meta-for-shares.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix /dav/meta endpoint for shares

We fixed a bug in the /dav/meta endpoint leading to internal server errors when used with shares.

https://github.com/cs3org/reva/pull/4432
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,27 @@ func (s *service) GetPath(ctx context.Context, req *provider.GetPathRequest) (*p
}, nil
}

return nil, gstatus.Errorf(codes.Unimplemented, "method not implemented")
receivedShare, rpcStatus, err := s.resolveAcceptedShare(ctx, &provider.Reference{
ResourceId: req.ResourceId,
})
appctx.GetLogger(ctx).Debug().
Interface("resourceId", req.ResourceId).
Interface("received_share", receivedShare).
Msg("sharesstorageprovider: Got GetPath request")
if err != nil {
return nil, err
}
if rpcStatus.Code != rpc.Code_CODE_OK {
return &provider.GetPathResponse{
Status: rpcStatus,
}, nil
}

return &provider.GetPathResponse{
Status: status.NewOK(ctx),
Path: receivedShare.MountPoint.Path,
}, nil

}

func (s *service) GetHome(ctx context.Context, req *provider.GetHomeRequest) (*provider.GetHomeResponse, error) {
Expand Down
13 changes: 10 additions & 3 deletions internal/grpc/services/usershareprovider/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,16 @@ func (s *service) GetReceivedShare(ctx context.Context, req *collaboration.GetRe
share, err := s.sm.GetReceivedShare(ctx, req.Ref)
if err != nil {
log.Err(err).Msg("error getting received share")
return &collaboration.GetReceivedShareResponse{
Status: status.NewInternal(ctx, "error getting received share"),
}, nil
switch err.(type) {
case errtypes.NotFound:
return &collaboration.GetReceivedShareResponse{
Status: status.NewNotFound(ctx, "error getting received share"),
}, nil
default:
return &collaboration.GetReceivedShareResponse{
Status: status.NewInternal(ctx, "error getting received share"),
}, nil
}
}

res := &collaboration.GetReceivedShareResponse{
Expand Down

0 comments on commit 457e007

Please sign in to comment.