Skip to content

Commit

Permalink
Remove ocm fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Aug 14, 2020
1 parent a090436 commit 4c148cc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/cheggaaa/pb v1.0.29
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/cs3org/cato v0.0.0-20200626150132-28a40e643719
github.com/cs3org/go-cs3apis v0.0.0-20200810113633-b00aca449666
github.com/cs3org/go-cs3apis v0.0.0-20200730121022-c4f3d4f7ddfd
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59
github.com/go-ldap/ldap/v3 v3.2.3
Expand Down Expand Up @@ -40,6 +40,7 @@ require (
github.com/rs/cors v1.7.0
github.com/rs/zerolog v1.19.0
github.com/stretchr/testify v1.6.1
github.com/studio-b12/gowebdav v0.0.0-20200303150724-9380631c29a1 // indirect
github.com/tus/tusd v1.1.1-0.20200416115059-9deabf9d80c2
go.opencensus.io v0.22.4
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ github.com/cs3org/go-cs3apis v0.0.0-20200728114537-4efa23660dbe h1:CQ/Grq7oVFqwi
github.com/cs3org/go-cs3apis v0.0.0-20200728114537-4efa23660dbe/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20200730121022-c4f3d4f7ddfd h1:uMaudkC7znaiIKT9rxIhoRYzrhTg1Nc78X7XEqhmjSk=
github.com/cs3org/go-cs3apis v0.0.0-20200730121022-c4f3d4f7ddfd/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20200810113633-b00aca449666 h1:E7VsSSN/2YZLSwrDMJJdAWU11lP7W1qkcXbrslb0PM0=
github.com/cs3org/go-cs3apis v0.0.0-20200810113633-b00aca449666/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -698,6 +696,8 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/studio-b12/gowebdav v0.0.0-20200303150724-9380631c29a1 h1:TPyHV/OgChqNcnYqCoCvIFjR9TU60gFXXBKnhOBzVEI=
github.com/studio-b12/gowebdav v0.0.0-20200303150724-9380631c29a1/go.mod h1:gCcfDlA1Y7GqOaeEKw5l9dOGx1VLdc/HuQSlQAaZ30s=
github.com/subosito/gotenv v1.1.1/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
Expand Down
8 changes: 7 additions & 1 deletion internal/grpc/services/gateway/ocmshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,18 @@ func (s *svc) createWebdavReference(ctx context.Context, share *ocm.Share) (*rpc
return status.NewInternal(ctx, err, "error updating received share"), nil
}

parts := strings.Split(share.Id.OpaqueId, ":")
if len(parts) < 2 {
err := errors.New("resource ID does not follow the layout id:name ")
return status.NewInternal(ctx, err, "error decoding resource ID"), nil
}

// reference path is the home path + some name on the corresponding
// mesh provider (webdav:/home/MyShares/x@webdav_endpoint)
// It is the responsibility of the gateway to resolve these references and merge the response back
// from the main request.
// TODO(labkode): the name of the share should be the filename it points to by default.
refPath := path.Join(homeRes.Path, s.c.ShareFolder, share.Name)
refPath := path.Join(homeRes.Path, s.c.ShareFolder, path.Base(parts[1]))
log.Info().Msg("mount path will be:" + refPath)

createRefReq := &provider.CreateReferenceRequest{
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
return nil, errors.New("json: owner of resource not provided")
}
userID = owner
id += ":" + name
} else {
userID = user.ContextMustGetUser(ctx).GetId()
}
Expand Down Expand Up @@ -243,7 +244,6 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
Id: &ocm.ShareId{
OpaqueId: id,
},
Name: name,
ResourceId: md,
Permissions: g.Permissions,
Grantee: g.Grantee,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/share/manager/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
return nil, errors.New("json: owner of resource not provided")
}
userID = owner
id += ":" + name
} else {
userID = user.ContextMustGetUser(ctx).GetId()
}
Expand Down Expand Up @@ -152,7 +153,6 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
Id: &ocm.ShareId{
OpaqueId: id,
},
Name: name,
ResourceId: md,
Permissions: g.Permissions,
Grantee: g.Grantee,
Expand Down

0 comments on commit 4c148cc

Please sign in to comment.