Skip to content

Commit

Permalink
WIP: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 4, 2022
1 parent a37ef2e commit 3b5e1b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/cs3org/reva/v2/pkg/appctx"
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/rgrpc"
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
Expand Down Expand Up @@ -272,6 +273,14 @@ func (s *service) GetPath(ctx context.Context, req *provider.GetPathRequest) (*p
// - getPath of every received share on the same space - needs also owner permissions -> needs machine auth
// - find the shortest root path that is a prefix of the resource path
// alternatively implement this on storageprovider - it needs to know about grants to do so

if isShareJailRoot(req.ResourceId) {
return &provider.GetPathResponse{
Status: status.NewOK(ctx),
Path: "/",
}, nil
}

return nil, gstatus.Errorf(codes.Unimplemented, "method not implemented")
}

Expand Down Expand Up @@ -690,7 +699,8 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
PermissionSet: &provider.ResourcePermissions{
// TODO
},
Etag: shareMd[earliestShare.Id.OpaqueId].ETag,
Etag: shareMd[earliestShare.Id.OpaqueId].ETag,
Owner: ctxpkg.ContextMustGetUser(ctx).Id,
},
}, nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (s *svc) sspReferenceIsChildOf(ctx context.Context, client gatewayv1beta1.G
return false, err
}

cp := childPathRes.Path
cp := childPathRes.Path + "/"
pp := parentPathRes.Path + "/"
return strings.HasPrefix(cp, pp), nil
}
Expand Down Expand Up @@ -485,7 +485,7 @@ func (s *svc) referenceIsChildOf(ctx context.Context, client gatewayv1beta1.Gate
return false, err
}

return strings.HasPrefix(
path.Join(childPathRes.Path, child.Path),
path.Join(parentPathRes.Path, parent.Path)+"/"), nil
cp := path.Join(childPathRes.Path, child.Path) + "/"
pp := path.Join(parentPathRes.Path, parent.Path) + "/"
return strings.HasPrefix(cp, pp), nil
}

0 comments on commit 3b5e1b9

Please sign in to comment.