From 6dae32796203162b2fb73c145e6a98d08e65ff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 3 Jun 2022 15:36:19 +0000 Subject: [PATCH] reorder functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .../sharesstorageprovider.go | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index f97940b423..b15c38e084 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -632,26 +632,6 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide }) } -// isRename checks if the two references lie in the responsibility of the sharesstorageprovider and if a rename occurs -func isRename(s, d *provider.Reference) bool { - // if the source is a share jail child where the path is . - return ((isShareJailChild(s.ResourceId) && s.Path == ".") || - // or if the source is the share jail with a single path segment, e.g. './old' - (isShareJailRoot(s.ResourceId) && len(strings.SplitN(s.Path, "/", 3)) == 2)) && - // and if the destination is the share jail a single path segment, e.g. './new' - isShareJailRoot(d.ResourceId) && len(strings.SplitN(d.Path, "/", 3)) == 2 -} - -func isShareJailRoot(id *provider.ResourceId) bool { - _, space := storagespace.SplitStorageID(id.StorageId) - return space == utils.ShareStorageProviderID && id.OpaqueId == utils.ShareStorageProviderID -} - -func isShareJailChild(id *provider.ResourceId) bool { - _, space := storagespace.SplitStorageID(id.StorageId) - return space == utils.ShareStorageProviderID && id.OpaqueId != utils.ShareStorageProviderID -} - // SetLock puts a lock on the given reference func (s *service) SetLock(ctx context.Context, req *provider.SetLockRequest) (*provider.SetLockResponse, error) { return nil, gstatus.Errorf(codes.Unimplemented, "method not implemented") @@ -1089,6 +1069,26 @@ func buildReferenceInShare(ref *provider.Reference, s *collaboration.ReceivedSha } } +// isRename checks if the two references lie in the responsibility of the sharesstorageprovider and if a rename occurs +func isRename(s, d *provider.Reference) bool { + // if the source is a share jail child where the path is . + return ((isShareJailChild(s.ResourceId) && s.Path == ".") || + // or if the source is the share jail with a single path segment, e.g. './old' + (isShareJailRoot(s.ResourceId) && len(strings.SplitN(s.Path, "/", 3)) == 2)) && + // and if the destination is the share jail a single path segment, e.g. './new' + isShareJailRoot(d.ResourceId) && len(strings.SplitN(d.Path, "/", 3)) == 2 +} + +func isShareJailChild(id *provider.ResourceId) bool { + _, space := storagespace.SplitStorageID(id.StorageId) + return space == utils.ShareStorageProviderID && id.OpaqueId != utils.ShareStorageProviderID +} + +func isShareJailRoot(id *provider.ResourceId) bool { + _, space := storagespace.SplitStorageID(id.StorageId) + return space == utils.ShareStorageProviderID && id.OpaqueId == utils.ShareStorageProviderID +} + func isVirtualRoot(ref *provider.Reference) bool { return isShareJailRoot(ref.ResourceId) && (ref.Path == "" || ref.Path == "." || ref.Path == "./") }