Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Remove create OCM reference code for a data transfer type share. (cs3…
Browse files Browse the repository at this point in the history
…org#2979)

Co-authored-by: Antoon P <[email protected]>
  • Loading branch information
2 people authored and vascoguita committed Oct 18, 2022
1 parent 58fd1f4 commit 32c5b26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-redundant-datatx-code.md
Original file line number Diff line number Diff line change
@@ -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
32 changes: 7 additions & 25 deletions internal/grpc/services/gateway/ocmshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 32c5b26

Please sign in to comment.