From bb1c887862aa37271defecc9f7c4a337ce2427ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 25 Oct 2023 08:51:10 +0200 Subject: [PATCH] Disallow moves between shares, even if they resolve to the same space. --- .../sharesstorageprovider/sharesstorageprovider.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index e363aec269..d0d1b1fa5c 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -591,6 +591,12 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide Interface("destination", req.Destination). Msg("sharesstorageprovider: Got Move request") + if !utils.ResourceIDEqual(req.Source.ResourceId, req.Destination.ResourceId) { + return &provider.MoveResponse{ + Status: status.NewUnimplemented(ctx, nil, "sharesstorageprovider: can not move between shares"), + }, nil + } + // TODO moving inside a shared tree should just be a forward of the move // but when do we rename a mounted share? Does that request even hit us? // - the registry needs to invalidate the alias @@ -643,11 +649,6 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide Status: rpcStatus, }, nil } - if srcReceivedShare.Share.ResourceId.SpaceId != dstReceivedShare.Share.ResourceId.SpaceId { - return &provider.MoveResponse{ - Status: status.NewInvalid(ctx, "sharesstorageprovider: can not move between shares on different storages"), - }, nil - } gatewayClient, err := s.gatewaySelector.Next() if err != nil {