diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index c50fba4c20..d50d002417 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -840,14 +840,12 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St appctx.GetLogger(ctx).Warn().Msg("gateway: more than one provider found for root, picking first") // what if there is more than one provider? pick random one? } - spaceID := "" - mp := shareProviderInfos[0].ProviderPath spacePaths := decodeSpacePaths(shareProviderInfos[0].Opaque) if len(spacePaths) == 0 { spacePaths[""] = mountPath } - for spaceID, mp = range spacePaths { + for spaceID, mp := range spacePaths { shareRootSpace, shareRootNode := utils.SplitStorageSpaceID(spaceID) if shareRootSpace == statResp.Info.Id.StorageId && shareRootNode == spaceRoot { mountPath = mp diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index 44e03c2856..7f06d2eaeb 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -314,7 +314,6 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora }, nil } case provider.ListStorageSpacesRequest_Filter_TYPE_ID: - //var spaceid string _, nodeid = utils.SplitStorageSpaceID(f.GetId().OpaqueId) } } @@ -330,11 +329,6 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora res := &provider.ListStorageSpacesResponse{} for i := range lsRes.Shares { - //if lsRes.Shares[i].MountPoint == nil { - // TODO return all as type "share", only mounted ones below also as "reference"? - // the gateway needs a name to use as the path segment in the dir listing - // continue - //} if nodeid != "" && nodeid != lsRes.Shares[i].Share.ResourceId.OpaqueId { // only a specific share was requested continue @@ -486,10 +480,6 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide // Change the MountPoint of the share, it has no relative prefix srcReceivedShare.MountPoint = &provider.Reference{ // FIXME actually it does have a resource id: the one of the sharesstorageprovider - //ResourceId: &provider.ResourceId{ - // StorageId: "a0ca6a90-a365-4782-871e-d44447bbc668", - // OpaqueId: "a0ca6a90-a365-4782-871e-d44447bbc668", // FIXME or use the node id of the resource? - //}, Path: filepath.Base(req.Destination.Path), } @@ -579,8 +569,10 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide }) if err == nil && sRes.Status.Code == rpc.Code_CODE_OK { + // overwrite id to make subsequent stat calls use the mount point + // of the sharesstorageprovider to build absolute paths + // TODO use share id as opaque id? sRes.Info.Id.StorageId = "a0ca6a90-a365-4782-871e-d44447bbc668" - //sRes.Info.Path = "" // the path of a share is determined by the mount point } return sRes, err diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index e261e82607..29fc69f636 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -831,13 +831,13 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { } else { var status *rpc.Status // FIXME the ResourceID is the id of the resource, but we want the id of the mount point so we can fetch that path, well we have the mountpoint path in the receivedshare - //info, status, err = h.getResourceInfoByID(ctx, client, rs.Share.ResourceId) - + // first stat mount point info, status, err = h.getResourceInfoByID(ctx, client, &provider.ResourceId{ StorageId: "a0ca6a90-a365-4782-871e-d44447bbc668", OpaqueId: rs.Share.ResourceId.OpaqueId, }) if err != nil || status.Code != rpc.Code_CODE_OK { + // fallback to unmounted resource info, status, err = h.getResourceInfoByID(ctx, client, rs.Share.ResourceId) if err != nil || status.Code != rpc.Code_CODE_OK { h.logProblems(status, err, "could not stat, skipping") @@ -923,15 +923,6 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { response.WriteOCSSuccess(w, r, shares) } -func findMatch(shareJailInfos []*provider.ResourceInfo, id *provider.ResourceId) *provider.ResourceInfo { - for i := range shareJailInfos { - if shareJailInfos[i].Id != nil && shareJailInfos[i].Id.StorageId == id.StorageId && shareJailInfos[i].Id.OpaqueId == id.OpaqueId { - return shareJailInfos[i] - } - } - return nil -} - func (h *Handler) listSharesWithOthers(w http.ResponseWriter, r *http.Request) { shares := make([]*conversions.ShareData, 0) diff --git a/pkg/storage/utils/decomposedfs/node/node.go b/pkg/storage/utils/decomposedfs/node/node.go index 839b0a5ab9..0ce855a57d 100644 --- a/pkg/storage/utils/decomposedfs/node/node.go +++ b/pkg/storage/utils/decomposedfs/node/node.go @@ -873,7 +873,6 @@ func (n *Node) ReadUserPermissions(ctx context.Context, u *userpb.User) (provide userace := xattrs.GrantPrefix + xattrs.UserAcePrefix + u.Id.OpaqueId userFound := false for i := range grantees { - err = nil switch { // we only need to find the user once case !userFound && grantees[i] == userace: