diff --git a/changelog/unreleased/fix-remove-group-from-share.md b/changelog/unreleased/fix-remove-group-from-share.md new file mode 100644 index 00000000000..4d9013558c5 --- /dev/null +++ b/changelog/unreleased/fix-remove-group-from-share.md @@ -0,0 +1,6 @@ +Bugfix: Fix nil pointer when removing groups from space + +We fixed the nil pointer when removing groups from space via graph + +https://github.com/cs3org/reva/pull/4635 +https://github.com/owncloud/ocis/issues/8768 diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index 781295963da..1541fff8745 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -250,14 +250,14 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp for _, f := range req.Filters { switch f.Type { case provider.ListStorageSpacesRequest_Filter_TYPE_ID: - sid, spid, oid, err := storagespace.SplitID(f.GetId().OpaqueId) + sid, spid, oid, err := storagespace.SplitID(f.GetId().GetOpaqueId()) if err != nil { continue } filters["storage_id"], filters["space_id"], filters["opaque_id"] = sid, spid, oid case provider.ListStorageSpacesRequest_Filter_TYPE_OWNER: - filters["owner_idp"] = f.GetOwner().Idp - filters["owner_id"] = f.GetOwner().OpaqueId + filters["owner_idp"] = f.GetOwner().GetIdp() + filters["owner_id"] = f.GetOwner().GetOpaqueId() case provider.ListStorageSpacesRequest_Filter_TYPE_SPACE_TYPE: filters["space_type"] = f.GetSpaceType() case provider.ListStorageSpacesRequest_Filter_TYPE_USER: @@ -339,7 +339,7 @@ func (s *svc) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorag _, purge = opaque.Map["purge"] } - rid, err := storagespace.ParseID(req.Id.OpaqueId) + rid, err := storagespace.ParseID(req.GetId().GetOpaqueId()) if err != nil { return &provider.DeleteStorageSpaceResponse{ Status: status.NewStatusFromErrType(ctx, fmt.Sprintf("gateway could not parse space id %s", req.GetId().GetOpaqueId()), err), @@ -361,7 +361,7 @@ func (s *svc) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorag }, nil } - id := &provider.ResourceId{OpaqueId: req.Id.OpaqueId} + id := &provider.ResourceId{OpaqueId: req.GetId().GetOpaqueId()} s.providerCache.RemoveListStorageProviders(id) if dsRes.Status.Code != rpc.Code_CODE_OK { @@ -1221,11 +1221,11 @@ func unwrap(ref *provider.Reference, mountPoint string, root *provider.ResourceI return &provider.Reference{ ResourceId: &provider.ResourceId{ - StorageId: ref.ResourceId.StorageId, - SpaceId: ref.ResourceId.SpaceId, - OpaqueId: ref.ResourceId.OpaqueId, + StorageId: ref.GetResourceId().GetStorageId(), + SpaceId: ref.GetResourceId().GetSpaceId(), + OpaqueId: ref.GetResourceId().GetOpaqueId(), }, - Path: ref.Path, + Path: ref.GetPath(), } } diff --git a/internal/grpc/services/gateway/usershareprovider.go b/internal/grpc/services/gateway/usershareprovider.go index fb3057638f4..25a1a2965d4 100644 --- a/internal/grpc/services/gateway/usershareprovider.go +++ b/internal/grpc/services/gateway/usershareprovider.go @@ -45,9 +45,9 @@ func (s *svc) CreateShare(ctx context.Context, req *collaboration.CreateShareReq } func (s *svc) RemoveShare(ctx context.Context, req *collaboration.RemoveShareRequest) (*collaboration.RemoveShareResponse, error) { - key := req.Ref.GetKey() + key := req.GetRef().GetKey() if !s.c.UseCommonSpaceRootShareLogic && shareIsSpaceRoot(key) { - return s.removeSpaceShare(ctx, key.ResourceId, key.Grantee) + return s.removeSpaceShare(ctx, key.GetResourceId(), key.GetGrantee()) } return s.removeShare(ctx, req) } @@ -149,7 +149,7 @@ func (s *svc) updateShare(ctx context.Context, req *collaboration.UpdateShareReq if updateGrantStatus.Code != rpc.Code_CODE_OK { return &collaboration.UpdateShareResponse{ Status: updateGrantStatus, - Share: res.Share, + Share: res.GetShare(), }, nil } } @@ -835,11 +835,11 @@ func isEqualGrantee(a, b *provider.Grantee) bool { var aID, bID string switch a.Type { case provider.GranteeType_GRANTEE_TYPE_GROUP: - aID = a.GetGroupId().OpaqueId - bID = b.GetGroupId().OpaqueId + aID = a.GetGroupId().GetOpaqueId() + bID = b.GetGroupId().GetOpaqueId() case provider.GranteeType_GRANTEE_TYPE_USER: - aID = a.GetUserId().OpaqueId - bID = b.GetUserId().OpaqueId + aID = a.GetUserId().GetOpaqueId() + bID = b.GetUserId().GetOpaqueId() } return aID == bID }