From 614bc7e6ac952f216289aa5483a6cdab96f55cd3 Mon Sep 17 00:00:00 2001 From: Antoon P Date: Mon, 26 Sep 2022 12:02:23 +0200 Subject: [PATCH] Remove create OCM reference code for a data transfer type share. (#2979) Co-authored-by: Antoon P --- .../unreleased/fix-redundant-datatx-code.md | 5 +++ .../grpc/services/gateway/ocmshareprovider.go | 32 ++++--------------- 2 files changed, 12 insertions(+), 25 deletions(-) create mode 100644 changelog/unreleased/fix-redundant-datatx-code.md diff --git a/changelog/unreleased/fix-redundant-datatx-code.md b/changelog/unreleased/fix-redundant-datatx-code.md new file mode 100644 index 0000000000..ebad752c19 --- /dev/null +++ b/changelog/unreleased/fix-redundant-datatx-code.md @@ -0,0 +1,5 @@ +Bugfix: removed unused datatx code + +An OCM reference is not created for a data transfer type share. + +https://github.com/cs3org/reva/pull/2979 \ No newline at end of file diff --git a/internal/grpc/services/gateway/ocmshareprovider.go b/internal/grpc/services/gateway/ocmshareprovider.go index afdb56c459..f15bd2eb1f 100644 --- a/internal/grpc/services/gateway/ocmshareprovider.go +++ b/internal/grpc/services/gateway/ocmshareprovider.go @@ -474,31 +474,13 @@ func (s *svc) createOCMReference(ctx context.Context, share *ocm.Share) (*rpc.St } var refPath, targetURI string - if share.ShareType == ocm.Share_SHARE_TYPE_TRANSFER { - createTransferDir, err := s.CreateContainer(ctx, &provider.CreateContainerRequest{ - Ref: &provider.Reference{ - Path: path.Join(homeRes.Path, s.c.DataTransfersFolder), - }, - }) - if err != nil { - return status.NewInternal(ctx, err, "error creating transfers directory"), nil - } - if createTransferDir.Status.Code != rpc.Code_CODE_OK && createTransferDir.Status.Code != rpc.Code_CODE_ALREADY_EXISTS { - err := status.NewErrorFromCode(createTransferDir.Status.GetCode(), "gateway") - return status.NewInternal(ctx, err, "error creating transfers directory"), nil - } - - refPath = path.Join(homeRes.Path, s.c.DataTransfersFolder, path.Base(share.Name)) - targetURI = fmt.Sprintf("datatx://%s@%s?name=%s", token, share.Creator.Idp, share.Name) - } else { - // reference path is the home path + some name on the corresponding - // mesh provider (/home/MyShares/x) - // It is the responsibility of the gateway to resolve these references and merge the response back - // from the main request. - refPath = path.Join(homeRes.Path, s.c.ShareFolder, path.Base(share.Name)) - // webdav is the scheme, token@host the opaque part and the share name the query of the URL. - targetURI = fmt.Sprintf("webdav://%s@%s?name=%s", token, share.Creator.Idp, share.Name) - } + // reference path is the home path + some name on the corresponding + // mesh provider (/home/MyShares/x) + // It is the responsibility of the gateway to resolve these references and merge the response back + // from the main request. + refPath = path.Join(homeRes.Path, s.c.ShareFolder, path.Base(share.Name)) + // webdav is the scheme, token@host the opaque part and the share name the query of the URL. + targetURI = fmt.Sprintf("webdav://%s@%s?name=%s", token, share.Creator.Idp, share.Name) log.Info().Msg("mount path will be:" + refPath) createRefReq := &provider.CreateReferenceRequest{