diff --git a/changelog/unreleased/change-references.md b/changelog/unreleased/change-references.md new file mode 100644 index 0000000000..8013fad047 --- /dev/null +++ b/changelog/unreleased/change-references.md @@ -0,0 +1,8 @@ +Change: absolute and relative references + +We unified the `Reference_Id` end `Reference_Path` types to a combined `Reference` that contains both: +- a `resource_id` property that can identify a node using a `storage_id` and an `opaque_id` +- a `path` property that can be used to represent absolute paths as well as paths relative to the id based properties. +While this is a breaking change it allows passing both: absolute as well as relative references. + +https://github.com/cs3org/reva/pull/1721 \ No newline at end of file diff --git a/cmd/reva/app-tokens-create.go b/cmd/reva/app-tokens-create.go index f23295f5e7..9b5a0d46f7 100644 --- a/cmd/reva/app-tokens-create.go +++ b/cmd/reva/app-tokens-create.go @@ -213,13 +213,7 @@ func getPathScope(ctx context.Context, client gateway.GatewayAPIClient, path, pe return nil, err } - statResponse, err := client.Stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path, - }, - }, - }) + statResponse, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: path}}) if err != nil { return nil, err diff --git a/cmd/reva/download.go b/cmd/reva/download.go index 53b38a098b..7dcb383a2c 100644 --- a/cmd/reva/download.go +++ b/cmd/reva/download.go @@ -55,9 +55,7 @@ func downloadCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: remote}, - } + ref := &provider.Reference{Path: remote} req1 := &provider.StatRequest{Ref: ref} ctx := getAuthContext() res1, err := client.Stat(ctx, req1) @@ -71,11 +69,7 @@ func downloadCommand() *command { info := res1.Info req2 := &provider.InitiateFileDownloadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: remote, - }, - }, + Ref: &provider.Reference{Path: remote}, } res, err := client.InitiateFileDownload(ctx, req2) if err != nil { diff --git a/cmd/reva/ls.go b/cmd/reva/ls.go index fa93fd9517..d2201058ae 100644 --- a/cmd/reva/ls.go +++ b/cmd/reva/ls.go @@ -51,9 +51,7 @@ func lsCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.ListContainerRequest{Ref: ref} ctx := getAuthContext() diff --git a/cmd/reva/mkdir.go b/cmd/reva/mkdir.go index d98b474319..c81e7560d6 100644 --- a/cmd/reva/mkdir.go +++ b/cmd/reva/mkdir.go @@ -43,9 +43,7 @@ func mkdirCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.CreateContainerRequest{Ref: ref} res, err := client.CreateContainer(ctx, req) if err != nil { diff --git a/cmd/reva/mv.go b/cmd/reva/mv.go index bacb13aeb6..72a9bd09ef 100644 --- a/cmd/reva/mv.go +++ b/cmd/reva/mv.go @@ -44,12 +44,8 @@ func moveCommand() *command { return err } - sourceRef := &provider.Reference{ - Spec: &provider.Reference_Path{Path: src}, - } - targetRef := &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - } + sourceRef := &provider.Reference{Path: src} + targetRef := &provider.Reference{Path: dst} req := &provider.MoveRequest{Source: sourceRef, Destination: targetRef} res, err := client.Move(ctx, req) if err != nil { diff --git a/cmd/reva/ocm-share-create.go b/cmd/reva/ocm-share-create.go index aa83d57857..3ec838fef8 100644 --- a/cmd/reva/ocm-share-create.go +++ b/cmd/reva/ocm-share-create.go @@ -87,9 +87,7 @@ func ocmShareCreateCommand() *command { return formatError(remoteUserRes.Status) } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{Ref: ref} res, err := client.Stat(ctx, req) if err != nil { diff --git a/cmd/reva/open-file-in-app-provider.go b/cmd/reva/open-file-in-app-provider.go index 7be45c9dcf..aee37ea492 100644 --- a/cmd/reva/open-file-in-app-provider.go +++ b/cmd/reva/open-file-in-app-provider.go @@ -59,9 +59,7 @@ func openFileInAppProviderCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: path}, - } + ref := &provider.Reference{Path: path} opaqueObj := &typespb.Opaque{ Map: map[string]*typespb.OpaqueEntry{}, diff --git a/cmd/reva/open-in-app.go b/cmd/reva/open-in-app.go index 46451bc20d..7a6712dd39 100644 --- a/cmd/reva/open-in-app.go +++ b/cmd/reva/open-in-app.go @@ -62,7 +62,7 @@ func openInAppCommand() *command { } ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: path}, + Path: path, } opaqueObj := &typespb.Opaque{ diff --git a/cmd/reva/public-share-create.go b/cmd/reva/public-share-create.go index b50af172a5..f22eac189b 100644 --- a/cmd/reva/public-share-create.go +++ b/cmd/reva/public-share-create.go @@ -53,9 +53,7 @@ func publicShareCreateCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{Ref: ref} res, err := client.Stat(ctx, req) diff --git a/cmd/reva/recycle-list.go b/cmd/reva/recycle-list.go index 649ae48dc2..6fd9f256f5 100644 --- a/cmd/reva/recycle-list.go +++ b/cmd/reva/recycle-list.go @@ -47,9 +47,7 @@ func recycleListCommand() *command { req := &gateway.ListRecycleRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, + Path: getHomeRes.Path, }, } res, err := client.ListRecycle(ctx, req) diff --git a/cmd/reva/recycle-purge.go b/cmd/reva/recycle-purge.go index d33e43553f..88e9585294 100644 --- a/cmd/reva/recycle-purge.go +++ b/cmd/reva/recycle-purge.go @@ -46,9 +46,7 @@ func recyclePurgeCommand() *command { req := &gateway.PurgeRecycleRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, + Path: getHomeRes.Path, }, } diff --git a/cmd/reva/recycle-restore.go b/cmd/reva/recycle-restore.go index 5915b21387..a081251053 100644 --- a/cmd/reva/recycle-restore.go +++ b/cmd/reva/recycle-restore.go @@ -52,9 +52,7 @@ func recycleRestoreCommand() *command { req := &provider.RestoreRecycleItemRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, + Path: getHomeRes.Path, }, Key: key, } diff --git a/cmd/reva/rm.go b/cmd/reva/rm.go index b596e745d0..d992564528 100644 --- a/cmd/reva/rm.go +++ b/cmd/reva/rm.go @@ -42,9 +42,7 @@ func rmCommand() *command { return err } - ref := &storageproviderv1beta1pb.Reference{ - Spec: &storageproviderv1beta1pb.Reference_Path{Path: fn}, - } + ref := &storageproviderv1beta1pb.Reference{Path: fn} req := &storageproviderv1beta1pb.DeleteRequest{Ref: ref} res, err := client.Delete(ctx, req) if err != nil { diff --git a/cmd/reva/share-create.go b/cmd/reva/share-create.go index 77194f07ab..1513569cef 100644 --- a/cmd/reva/share-create.go +++ b/cmd/reva/share-create.go @@ -63,10 +63,7 @@ func shareCreateCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } - + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{Ref: ref} res, err := client.Stat(ctx, req) if err != nil { diff --git a/cmd/reva/stat.go b/cmd/reva/stat.go index 29147038cd..c84cba9a0f 100644 --- a/cmd/reva/stat.go +++ b/cmd/reva/stat.go @@ -44,9 +44,7 @@ func statCommand() *command { return err } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{Ref: ref} res, err := client.Stat(ctx, req) if err != nil { diff --git a/cmd/reva/transfer-create.go b/cmd/reva/transfer-create.go index 308c1b5438..f72d49c336 100644 --- a/cmd/reva/transfer-create.go +++ b/cmd/reva/transfer-create.go @@ -78,11 +78,7 @@ func transferCreateCommand() *command { // verify resource stats statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: fn, - }, - }, + Ref: &provider.Reference{Path: fn}, } statRes, err := client.Stat(ctx, statReq) if err != nil { diff --git a/cmd/reva/upload.go b/cmd/reva/upload.go index 56ca5d8db4..f9c969aba6 100644 --- a/cmd/reva/upload.go +++ b/cmd/reva/upload.go @@ -92,11 +92,7 @@ func uploadCommand() *command { } req := &provider.InitiateFileUploadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - }, + Ref: &provider.Reference{Path: target}, Opaque: &typespb.Opaque{ Map: map[string]*typespb.OpaqueEntry{ "Upload-Length": { @@ -212,11 +208,7 @@ func uploadCommand() *command { } req2 := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - }, + Ref: &provider.Reference{Path: target}, } res2, err := gwc.Stat(ctx, req2) if err != nil { diff --git a/go.mod b/go.mod index 47f2d2983b..aaccd4d28c 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,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-20200828125504-e418fc54dd5e - github.com/cs3org/go-cs3apis v0.0.0-20210527092509-2b828e94ed4c + github.com/cs3org/go-cs3apis v0.0.0-20210614143420-5ee2eb1e7887 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59 github.com/gdexlab/go-render v1.0.1 diff --git a/go.sum b/go.sum index 5392d0bbcf..3dc551b4a9 100644 --- a/go.sum +++ b/go.sum @@ -151,8 +151,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e h1:tqSPWQeueWTKnJVMJffz4pz0o1WuQxJ28+5x5JgaHD8= github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= -github.com/cs3org/go-cs3apis v0.0.0-20210527092509-2b828e94ed4c h1:EaKDtDswzfWUr70xoN63sPLZyvdinkmXrjqc5AFhVZE= -github.com/cs3org/go-cs3apis v0.0.0-20210527092509-2b828e94ed4c/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= +github.com/cs3org/go-cs3apis v0.0.0-20210614143420-5ee2eb1e7887 h1:X5Se3M/kbh9w6LZQvyLS7djAGKcWGzmaY6IOa7Talpk= +github.com/cs3org/go-cs3apis v0.0.0-20210614143420-5ee2eb1e7887/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/cucumber/godog v0.8.1/go.mod h1:vSh3r/lM+psC1BPXvdkSEuNjmXfpVqrMGYAElF6hxnA= 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= diff --git a/internal/grpc/interceptors/auth/auth.go b/internal/grpc/interceptors/auth/auth.go index a611023c56..b7618b4686 100644 --- a/internal/grpc/interceptors/auth/auth.go +++ b/internal/grpc/interceptors/auth/auth.go @@ -263,7 +263,7 @@ func dismantleToken(ctx context.Context, tkn string, req interface{}, mgr token. // has access to it. statReq := &provider.StatRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Id{Id: share.ResourceId}, + ResourceId: share.ResourceId, }, } @@ -280,7 +280,7 @@ func dismantleToken(ctx context.Context, tkn string, req interface{}, mgr token. } } - return nil, err + return nil, errtypes.PermissionDenied("access token has invalid scope") } func extractRef(req interface{}) (*provider.Reference, bool) { diff --git a/internal/grpc/services/gateway/appprovider.go b/internal/grpc/services/gateway/appprovider.go index 74297b4b9c..f7921c9520 100644 --- a/internal/grpc/services/gateway/appprovider.go +++ b/internal/grpc/services/gateway/appprovider.go @@ -67,11 +67,7 @@ func (s *svc) OpenInApp(ctx context.Context, req *gateway.OpenInAppRequest) (*pr } statRes, err := s.stat(ctx, &storageprovider.StatRequest{ - Ref: &storageprovider.Reference{ - Spec: &storageprovider.Reference_Path{ - Path: resName, - }, - }, + Ref: &storageprovider.Reference{Path: resName}, }) if err != nil { return &providerpb.OpenInAppResponse{ @@ -136,11 +132,7 @@ func (s *svc) openFederatedShares(ctx context.Context, targetURL string, vm gate return nil, err } - ref := &storageprovider.Reference{ - Spec: &storageprovider.Reference_Path{ - Path: ep.filePath, - }, - } + ref := &storageprovider.Reference{Path: ep.filePath} appProviderReq := &gateway.OpenInAppRequest{ Ref: ref, ViewMode: vm, diff --git a/internal/grpc/services/gateway/ocmshareprovider.go b/internal/grpc/services/gateway/ocmshareprovider.go index 872009d9c1..d1d686a846 100644 --- a/internal/grpc/services/gateway/ocmshareprovider.go +++ b/internal/grpc/services/gateway/ocmshareprovider.go @@ -318,9 +318,7 @@ func (s *svc) createOCMReference(ctx context.Context, share *ocm.Share) (*rpc.St if share.ShareType == ocm.Share_SHARE_TYPE_TRANSFER { createTransferDir, err := s.CreateContainer(ctx, &provider.CreateContainerRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join(homeRes.Path, s.c.DataTransfersFolder), - }, + Path: path.Join(homeRes.Path, s.c.DataTransfersFolder), }, }) if err != nil { @@ -345,7 +343,7 @@ func (s *svc) createOCMReference(ctx context.Context, share *ocm.Share) (*rpc.St log.Info().Msg("mount path will be:" + refPath) createRefReq := &provider.CreateReferenceRequest{ - Path: refPath, + Ref: &provider.Reference{Path: refPath}, TargetUri: targetURI, } diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index 90a5a04272..466bb7f303 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -122,9 +122,16 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp id = f.GetId() } } - c, err := s.findByID(ctx, &provider.ResourceId{ - OpaqueId: id.OpaqueId, - }) + parts := strings.SplitN(id.OpaqueId, "!", 2) + if len(parts) != 2 { + return &provider.ListStorageSpacesResponse{ + Status: status.NewInvalidArg(ctx, "space id must be separated by !"), + }, nil + } + c, err := s.find(ctx, &provider.Reference{ResourceId: &provider.ResourceId{ + StorageId: parts[0], // FIXME REFERENCE the StorageSpaceId is a storageid + a opaqueid + OpaqueId: parts[1], + }}) if err != nil { return &provider.ListStorageSpacesResponse{ Status: status.NewStatusFromErrType(ctx, "error finding path", err), @@ -144,7 +151,7 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp func (s *svc) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error) { log := appctx.GetLogger(ctx) // TODO: needs to be fixed - c, err := s.findByID(ctx, req.StorageSpace.Root) + c, err := s.find(ctx, &provider.Reference{ResourceId: req.StorageSpace.Root}) if err != nil { return &provider.UpdateStorageSpaceResponse{ Status: status.NewStatusFromErrType(ctx, "error finding ID", err), @@ -164,9 +171,16 @@ func (s *svc) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorag func (s *svc) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) (*provider.DeleteStorageSpaceResponse, error) { log := appctx.GetLogger(ctx) // TODO: needs to be fixed - c, err := s.findByID(ctx, &provider.ResourceId{ - OpaqueId: req.Id.OpaqueId, - }) + parts := strings.SplitN(req.Id.OpaqueId, "!", 2) + if len(parts) != 2 { + return &provider.DeleteStorageSpaceResponse{ + Status: status.NewInvalidArg(ctx, "space id must be separated by !"), + }, nil + } + c, err := s.find(ctx, &provider.Reference{ResourceId: &provider.ResourceId{ + StorageId: parts[0], // FIXME REFERENCE the StorageSpaceId is a storageid + a opaqueid + OpaqueId: parts[1], + }}) if err != nil { return &provider.DeleteStorageSpaceResponse{ Status: status.NewStatusFromErrType(ctx, "error finding path", err), @@ -282,12 +296,8 @@ func (s *svc) InitiateFileDownload(ctx context.Context, req *provider.InitiateFi // if it is a file allow download if ri.Type == provider.ResourceType_RESOURCE_TYPE_FILE { log.Debug().Str("path", p).Interface("ri", ri).Msg("path points to share name file") - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: ri.Path, - }, - } - log.Debug().Msg("download path: " + ri.Path) + req.Ref.Path = ri.Path + log.Debug().Str("path", ri.Path).Msg("download") return s.initiateFileDownload(ctx, req) } @@ -304,11 +314,7 @@ func (s *svc) InitiateFileDownload(ctx context.Context, req *provider.InitiateFi shareName, shareChild := s.splitShare(ctx, p) statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, + Ref: &provider.Reference{Path: shareName}, } statRes, err := s.stat(ctx, statReq) if err != nil { @@ -352,13 +358,8 @@ func (s *svc) InitiateFileDownload(ctx context.Context, req *provider.InitiateFi } // append child to target - target := path.Join(ri.Path, shareChild) - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - } - log.Debug().Msg("download path: " + target) + req.Ref.Path = path.Join(ri.Path, shareChild) + log.Debug().Str("path", req.Ref.Path).Msg("download") return s.initiateFileDownload(ctx, req) } @@ -494,12 +495,8 @@ func (s *svc) InitiateFileUpload(ctx context.Context, req *provider.InitiateFile // if it is a file allow upload if ri.Type == provider.ResourceType_RESOURCE_TYPE_FILE { log.Debug().Str("path", p).Interface("ri", ri).Msg("path points to share name file") - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: ri.Path, - }, - } - log.Debug().Msg("upload path: " + ri.Path) + req.Ref.Path = ri.Path + log.Debug().Str("path", ri.Path).Msg("upload") return s.initiateFileUpload(ctx, req) } @@ -515,13 +512,7 @@ func (s *svc) InitiateFileUpload(ctx context.Context, req *provider.InitiateFile log.Debug().Msgf("shared child: %s", p) shareName, shareChild := s.splitShare(ctx, p) - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: shareName}} statRes, err := s.stat(ctx, statReq) if err != nil { return &gateway.InitiateFileUploadResponse{ @@ -564,12 +555,7 @@ func (s *svc) InitiateFileUpload(ctx context.Context, req *provider.InitiateFile } // append child to target - target := path.Join(ri.Path, shareChild) - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - } + req.Ref.Path = path.Join(ri.Path, shareChild) return s.initiateFileUpload(ctx, req) } @@ -635,13 +621,7 @@ func (s *svc) initiateFileUpload(ctx context.Context, req *provider.InitiateFile } func (s *svc) GetPath(ctx context.Context, req *provider.GetPathRequest) (*provider.GetPathResponse, error) { - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: req.ResourceId, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{ResourceId: req.ResourceId}} statRes, err := s.stat(ctx, statReq) if err != nil { err = errors.Wrap(err, "gateway: error stating ref:"+statReq.Ref.String()) @@ -687,13 +667,7 @@ func (s *svc) CreateContainer(ctx context.Context, req *provider.CreateContainer log.Debug().Msgf("shared child: %s", p) shareName, shareChild := s.splitShare(ctx, p) - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: shareName}} statRes, err := s.stat(ctx, statReq) if err != nil { return &provider.CreateContainerResponse{ @@ -727,12 +701,7 @@ func (s *svc) CreateContainer(ctx context.Context, req *provider.CreateContainer } // append child to target - target := path.Join(ri.Path, shareChild) - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - } + req.Ref.Path = path.Join(ri.Path, shareChild) return s.createContainer(ctx, req) } @@ -788,11 +757,7 @@ func (s *svc) Delete(ctx context.Context, req *provider.DeleteRequest) (*provide if s.isShareName(ctx, p) { log.Debug().Msgf("path:%s points to share name", p) - ref := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: p, - }, - } + ref := &provider.Reference{Path: p} req.Ref = ref return s.delete(ctx, req) @@ -802,11 +767,7 @@ func (s *svc) Delete(ctx context.Context, req *provider.DeleteRequest) (*provide shareName, shareChild := s.splitShare(ctx, p) log.Debug().Msgf("path:%s sharename:%s sharechild: %s", p, shareName, shareChild) - ref := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - } + ref := &provider.Reference{Path: shareName} statReq := &provider.StatRequest{Ref: ref} statRes, err := s.stat(ctx, statReq) @@ -842,14 +803,7 @@ func (s *svc) Delete(ctx context.Context, req *provider.DeleteRequest) (*provide } // append child to target - target := path.Join(ri.Path, shareChild) - ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: target, - }, - } - - req.Ref = ref + req.Ref.Path = path.Join(ri.Path, shareChild) return s.delete(ctx, req) } @@ -913,13 +867,7 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo } - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: shareName}} statRes, err := s.stat(ctx, statReq) if err != nil { return &provider.MoveResponse{ @@ -953,14 +901,10 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo } src := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join(ri.Path, shareChild), - }, + Path: path.Join(ri.Path, shareChild), } dst := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join(ri.Path, dshareChild), - }, + Path: path.Join(ri.Path, dshareChild), } req.Source = src @@ -1043,13 +987,7 @@ func (s *svc) UnsetArbitraryMetadata(ctx context.Context, req *provider.UnsetArb } func (s *svc) statHome(ctx context.Context) (*provider.StatResponse, error) { - statRes, err := s.stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: s.getHome(ctx), - }, - }, - }) + statRes, err := s.stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: s.getHome(ctx)}}) if err != nil { return &provider.StatResponse{ Status: status.NewInternal(ctx, err, "gateway: error stating home"), @@ -1097,13 +1035,7 @@ func (s *svc) statHome(ctx context.Context) (*provider.StatResponse, error) { } func (s *svc) statSharesFolder(ctx context.Context) (*provider.StatResponse, error) { - statRes, err := s.stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: s.getSharedFolder(ctx), - }, - }, - }) + statRes, err := s.stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: s.getSharedFolder(ctx)}}) if err != nil { return &provider.StatResponse{ Status: status.NewInternal(ctx, err, "gateway: error stating shares folder"), @@ -1214,13 +1146,7 @@ func (s *svc) statOnProvider(ctx context.Context, req *provider.StatRequest, res if resPath != "" && !strings.HasPrefix(resPath, p.ProviderPath) { newPath = p.ProviderPath } - r, err := c.Stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: newPath, - }, - }, - }) + r, err := c.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: newPath}}) if err != nil { *e = errors.Wrap(err, "gateway: error calling ListContainer") return @@ -1296,13 +1222,7 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St if s.isShareChild(ctx, p) { shareName, shareChild := s.splitShare(ctx, p) - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: shareName}} statRes, err := s.stat(ctx, statReq) if err != nil { return &provider.StatResponse{ @@ -1338,11 +1258,7 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St } // append child to target - req.Ref = &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join(ri.Path, shareChild), - }, - } + req.Ref.Path = path.Join(ri.Path, shareChild) res, err := s.stat(ctx, req) if err != nil { return &provider.StatResponse{ @@ -1405,11 +1321,9 @@ func (s *svc) handleCS3Ref(ctx context.Context, opaque string) (*provider.Resour req := &provider.StatRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: &provider.ResourceId{ - StorageId: parts[0], - OpaqueId: parts[1], - }, + ResourceId: &provider.ResourceId{ + StorageId: parts[0], + OpaqueId: parts[1], }, }, } @@ -1447,11 +1361,7 @@ func (s *svc) ListContainerStream(_ *provider.ListContainerStreamRequest, _ gate func (s *svc) listHome(ctx context.Context, req *provider.ListContainerRequest) (*provider.ListContainerResponse, error) { lcr, err := s.listContainer(ctx, &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: s.getHome(ctx), - }, - }, + Ref: &provider.Reference{Path: s.getHome(ctx)}, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, }) if err != nil { @@ -1466,7 +1376,7 @@ func (s *svc) listHome(ctx context.Context, req *provider.ListContainerRequest) } for i := range lcr.Infos { - if s.isSharedFolder(ctx, lcr.Infos[i].Path) { + if s.isSharedFolder(ctx, lcr.Infos[i].GetPath()) { statSharedFolder, err := s.statSharesFolder(ctx) if err != nil { return &provider.ListContainerResponse{ @@ -1487,13 +1397,7 @@ func (s *svc) listHome(ctx context.Context, req *provider.ListContainerRequest) } func (s *svc) listSharesFolder(ctx context.Context) (*provider.ListContainerResponse, error) { - lcr, err := s.listContainer(ctx, &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: s.getSharedFolder(ctx), - }, - }, - }) + lcr, err := s.listContainer(ctx, &provider.ListContainerRequest{Ref: &provider.Reference{Path: s.getSharedFolder(ctx)}}) if err != nil { return &provider.ListContainerResponse{ Status: status.NewInternal(ctx, err, "gateway: error listing shared folder"), @@ -1524,7 +1428,7 @@ func (s *svc) listSharesFolder(ctx context.Context) (*provider.ListContainerResp } } - info.Path = lcr.Infos[i].GetPath() + info.Path = lcr.Infos[i].Path checkedInfos = append(checkedInfos, info) } lcr.Infos = checkedInfos @@ -1603,13 +1507,7 @@ func (s *svc) listContainerOnProvider(ctx context.Context, req *provider.ListCon if resPath != "" && !strings.HasPrefix(resPath, p.ProviderPath) { newPath = p.ProviderPath } - r, err := c.ListContainer(ctx, &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: newPath, - }, - }, - }) + r, err := c.ListContainer(ctx, &provider.ListContainerRequest{Ref: &provider.Reference{Path: newPath}}) if err != nil { *e = errors.Wrap(err, "gateway: error calling ListContainer") return @@ -1640,13 +1538,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ // we need to provide the info of the target, not the reference. if s.isShareName(ctx, p) { - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: p, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: p}} statRes, err := s.stat(ctx, statReq) if err != nil { return &provider.ListContainerResponse{ @@ -1694,11 +1586,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } newReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: ri.Path, - }, - }, + Ref: &provider.Reference{Path: ri.Path}, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, } newRes, err := s.listContainer(ctx, newReq) @@ -1727,13 +1615,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ if s.isShareChild(ctx, p) { shareName, shareChild := s.splitShare(ctx, p) - statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: shareName, - }, - }, - } + statReq := &provider.StatRequest{Ref: &provider.Reference{Path: shareName}} statRes, err := s.stat(ctx, statReq) if err != nil { return &provider.ListContainerResponse{ @@ -1781,11 +1663,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } newReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join(ri.Path, shareChild), - }, - }, + Ref: &provider.Reference{Path: path.Join(ri.Path, shareChild)}, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, } newRes, err := s.listContainer(ctx, newReq) @@ -1815,11 +1693,9 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } func (s *svc) getPath(ctx context.Context, ref *provider.Reference, keys ...string) (string, *rpc.Status) { - if ref.GetPath() != "" { - return ref.GetPath(), &rpc.Status{Code: rpc.Code_CODE_OK} - } - if ref.GetId() != nil && ref.GetId().GetOpaqueId() != "" { + // check if it is an id based or combined reference first + if ref.ResourceId != nil { req := &provider.StatRequest{Ref: ref, ArbitraryMetadataKeys: keys} res, err := s.stat(ctx, req) if (res != nil && res.Status.Code != rpc.Code_CODE_OK) || err != nil { @@ -1829,6 +1705,9 @@ func (s *svc) getPath(ctx context.Context, ref *provider.Reference, keys ...stri return res.Info.Path, res.Status } + if ref.Path != "" { + return ref.Path, &rpc.Status{Code: rpc.Code_CODE_OK} + } return "", &rpc.Status{Code: rpc.Code_CODE_INTERNAL} } @@ -2017,21 +1896,8 @@ func (s *svc) GetQuota(ctx context.Context, req *gateway.GetQuotaRequest) (*prov return res, nil } -func (s *svc) findByID(ctx context.Context, id *provider.ResourceId) (provider.ProviderAPIClient, error) { - ref := &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: id, - }, - } - return s.find(ctx, ref) -} - func (s *svc) findByPath(ctx context.Context, path string) (provider.ProviderAPIClient, error) { - ref := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path, - }, - } + ref := &provider.Reference{Path: path} return s.find(ctx, ref) } diff --git a/internal/grpc/services/gateway/usershareprovider.go b/internal/grpc/services/gateway/usershareprovider.go index 175258765f..2e9536619a 100644 --- a/internal/grpc/services/gateway/usershareprovider.go +++ b/internal/grpc/services/gateway/usershareprovider.go @@ -321,11 +321,13 @@ func (s *svc) UpdateReceivedShare(ctx context.Context, req *collaboration.Update } func (s *svc) createReference(ctx context.Context, resourceID *provider.ResourceId) *rpc.Status { - + ref := &provider.Reference{ + ResourceId: resourceID, + } log := appctx.GetLogger(ctx) // get the metadata about the share - c, err := s.findByID(ctx, resourceID) + c, err := s.find(ctx, ref) if err != nil { if _, ok := err.(errtypes.IsNotFound); ok { return status.NewNotFound(ctx, "storage provider not found") @@ -334,11 +336,7 @@ func (s *svc) createReference(ctx context.Context, resourceID *provider.Resource } statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: resourceID, - }, - }, + Ref: ref, } statRes, err := c.Stat(ctx, statReq) @@ -372,7 +370,7 @@ func (s *svc) createReference(ctx context.Context, resourceID *provider.Resource log.Info().Msg("mount path will be:" + refPath) createRefReq := &provider.CreateReferenceRequest{ - Path: refPath, + Ref: &provider.Reference{Path: refPath}, // cs3 is the Scheme and %s/%s is the Opaque parts of a net.URL. TargetUri: fmt.Sprintf("cs3:%s/%s", resourceID.GetStorageId(), resourceID.GetOpaqueId()), } @@ -402,20 +400,19 @@ func (s *svc) createReference(ctx context.Context, resourceID *provider.Resource } func (s *svc) addGrant(ctx context.Context, id *provider.ResourceId, g *provider.Grantee, p *provider.ResourcePermissions) (*rpc.Status, error) { + ref := &provider.Reference{ + ResourceId: id, + } grantReq := &provider.AddGrantRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: id, - }, - }, + Ref: ref, Grant: &provider.Grant{ Grantee: g, Permissions: p, }, } - c, err := s.findByID(ctx, id) + c, err := s.find(ctx, ref) if err != nil { if _, ok := err.(errtypes.IsNotFound); ok { return status.NewNotFound(ctx, "storage provider not found"), nil @@ -436,20 +433,18 @@ func (s *svc) addGrant(ctx context.Context, id *provider.ResourceId, g *provider } func (s *svc) updateGrant(ctx context.Context, id *provider.ResourceId, g *provider.Grantee, p *provider.ResourcePermissions) (*rpc.Status, error) { - + ref := &provider.Reference{ + ResourceId: id, + } grantReq := &provider.UpdateGrantRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: id, - }, - }, + Ref: ref, Grant: &provider.Grant{ Grantee: g, Permissions: p, }, } - c, err := s.findByID(ctx, id) + c, err := s.find(ctx, ref) if err != nil { if _, ok := err.(errtypes.IsNotFound); ok { return status.NewNotFound(ctx, "storage provider not found"), nil @@ -470,20 +465,19 @@ func (s *svc) updateGrant(ctx context.Context, id *provider.ResourceId, g *provi } func (s *svc) removeGrant(ctx context.Context, id *provider.ResourceId, g *provider.Grantee, p *provider.ResourcePermissions) (*rpc.Status, error) { + ref := &provider.Reference{ + ResourceId: id, + } grantReq := &provider.RemoveGrantRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: id, - }, - }, + Ref: ref, Grant: &provider.Grant{ Grantee: g, Permissions: p, }, } - c, err := s.findByID(ctx, id) + c, err := s.find(ctx, ref) if err != nil { if _, ok := err.(errtypes.IsNotFound); ok { return status.NewNotFound(ctx, "storage provider not found"), nil diff --git a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go index b941b9b110..b53f5adf07 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -148,9 +148,7 @@ func (s *service) translatePublicRefToCS3Ref(ctx context.Context, ref *provider. return nil, "", nil, st, nil } - cs3Ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: path.Join("/", originalPath, relativePath)}, - } + cs3Ref := &provider.Reference{Path: path.Join("/", originalPath, relativePath)} log.Debug(). Interface("sourceRef", ref). Interface("cs3Ref", cs3Ref). @@ -473,13 +471,7 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide } var statResponse *provider.StatResponse // the call has to be made to the gateway instead of the storage. - statResponse, err = s.gateway.Stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: p, - }, - }, - }) + statResponse, err = s.gateway.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: p}}) if err != nil { return &provider.StatResponse{ Status: status.NewInternal(ctx, err, "gateway: error calling Stat for ref:"+req.Ref.String()), @@ -540,13 +532,7 @@ func (s *service) ListContainer(ctx context.Context, req *provider.ListContainer listContainerR, err := s.gateway.ListContainer( ctx, - &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path.Join("/", pathFromToken, relativePath), - }, - }, - }, + &provider.ListContainerRequest{Ref: &provider.Reference{Path: path.Join("/", pathFromToken, relativePath)}}, ) if err != nil { return &provider.ListContainerResponse{ @@ -587,8 +573,8 @@ func filterPermissions(l *provider.ResourcePermissions, r *provider.ResourcePerm } func (s *service) unwrap(ctx context.Context, ref *provider.Reference) (token string, relativePath string, err error) { - if ref.GetId() != nil { - return "", "", errtypes.BadRequest("need path based ref: got " + ref.String()) + if ref.ResourceId != nil { + return "", "", errtypes.BadRequest("need absolute path ref: got " + ref.String()) } if ref.GetPath() == "" { @@ -709,9 +695,7 @@ func (s *service) resolveToken(ctx context.Context, token string) (string, *link sRes, err := s.gateway.Stat(ctx, &provider.StatRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: publicShareResponse.GetShare().GetResourceId(), - }, + ResourceId: publicShareResponse.GetShare().GetResourceId(), }, }) switch { diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 7785771fcb..cc2f296c55 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -816,7 +816,7 @@ func (s *service) ListRecycle(ctx context.Context, req *provider.ListRecycleRequ func (s *service) RestoreRecycleItem(ctx context.Context, req *provider.RestoreRecycleItemRequest) (*provider.RestoreRecycleItemResponse, error) { // TODO(labkode): CRITICAL: fill recycle info with storage provider. - if err := s.storage.RestoreRecycleItem(ctx, req.Key, req.RestorePath); err != nil { + if err := s.storage.RestoreRecycleItem(ctx, req.Key, req.RestoreRef); err != nil { var st *rpc.Status switch err.(type) { case errtypes.IsNotFound: @@ -838,9 +838,9 @@ func (s *service) RestoreRecycleItem(ctx context.Context, req *provider.RestoreR } func (s *service) PurgeRecycle(ctx context.Context, req *provider.PurgeRecycleRequest) (*provider.PurgeRecycleResponse, error) { - // if a key was sent as opacque id purge only that item - if req.GetRef().GetId() != nil && req.GetRef().GetId().GetOpaqueId() != "" { - if err := s.storage.PurgeRecycleItem(ctx, req.GetRef().GetId().GetOpaqueId()); err != nil { + // if a key was sent as opaque id purge only that item + if req.GetRef().GetResourceId() != nil && req.GetRef().GetResourceId().OpaqueId != "" { + if err := s.storage.PurgeRecycleItem(ctx, req.GetRef().GetResourceId().OpaqueId); err != nil { var st *rpc.Status switch err.(type) { case errtypes.IsNotFound: @@ -1028,13 +1028,7 @@ func (s *service) CreateReference(ctx context.Context, req *provider.CreateRefer }, nil } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: req.Path, - }, - } - - newRef, err := s.unwrap(ctx, ref) + newRef, err := s.unwrap(ctx, req.Ref) if err != nil { return &provider.CreateReferenceResponse{ Status: status.NewInternal(ctx, err, "error unwrapping path"), @@ -1101,17 +1095,8 @@ func getFS(c *config) (storage.FS, error) { } func (s *service) unwrap(ctx context.Context, ref *provider.Reference) (*provider.Reference, error) { - if ref.GetId() != nil { - idRef := &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: &provider.ResourceId{ - StorageId: "", // we are unwrapping on purpose, bottom layers only need OpaqueId. - OpaqueId: ref.GetId().OpaqueId, - }, - }, - } - - return idRef, nil + if ref.GetResourceId() != nil { + return ref, nil } if ref.GetPath() == "" { @@ -1125,11 +1110,7 @@ func (s *service) unwrap(ctx context.Context, ref *provider.Reference) (*provide return nil, err } - pathRef := &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: fsfn, - }, - } + pathRef := &provider.Reference{Path: fsfn} return pathRef, nil } diff --git a/internal/http/services/owncloud/ocdav/copy.go b/internal/http/services/owncloud/ocdav/copy.go index 1a7e29a704..a3cbee49ec 100644 --- a/internal/http/services/owncloud/ocdav/copy.go +++ b/internal/http/services/owncloud/ocdav/copy.go @@ -81,9 +81,7 @@ func (s *svc) handleCopy(w http.ResponseWriter, r *http.Request, ns string) { } // check src exists - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: src}, - } + ref := &provider.Reference{Path: src} srcStatReq := &provider.StatRequest{Ref: ref} srcStatRes, err := client.Stat(ctx, srcStatReq) if err != nil { @@ -98,9 +96,7 @@ func (s *svc) handleCopy(w http.ResponseWriter, r *http.Request, ns string) { } // check dst exists - ref = &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - } + ref = &provider.Reference{Path: dst} dstStatReq := &provider.StatRequest{Ref: ref} dstStatRes, err := client.Stat(ctx, dstStatReq) if err != nil { @@ -126,9 +122,7 @@ func (s *svc) handleCopy(w http.ResponseWriter, r *http.Request, ns string) { } else { // check if an intermediate path / the parent exists intermediateDir := path.Dir(dst) - ref = &provider.Reference{ - Spec: &provider.Reference_Path{Path: intermediateDir}, - } + ref = &provider.Reference{Path: intermediateDir} intStatReq := &provider.StatRequest{Ref: ref} intStatRes, err := client.Stat(ctx, intStatReq) if err != nil { @@ -164,9 +158,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src if src.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { // create dir createReq := &provider.CreateContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - }, + Ref: &provider.Reference{Path: dst}, } createRes, err := client.CreateContainer(ctx, createReq) if err != nil || createRes.Status.Code != rpc.Code_CODE_OK { @@ -181,9 +173,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src // descend for children listReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: src.Path}, - }, + Ref: &provider.Reference{Path: src.Path}, } res, err := client.ListContainer(ctx, listReq) if err != nil { @@ -207,9 +197,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src // 1. get download url dReq := &provider.InitiateFileDownloadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: src.Path}, - }, + Ref: &provider.Reference{Path: src.Path}, } dRes, err := client.InitiateFileDownload(ctx, dReq) @@ -231,9 +219,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src // 2. get upload url uReq := &provider.InitiateFileUploadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - }, + Ref: &provider.Reference{Path: dst}, Opaque: &typespb.Opaque{ Map: map[string]*typespb.OpaqueEntry{ "Upload-Length": { diff --git a/internal/http/services/owncloud/ocdav/dav.go b/internal/http/services/owncloud/ocdav/dav.go index ca5abc1884..a1681fe29d 100644 --- a/internal/http/services/owncloud/ocdav/dav.go +++ b/internal/http/services/owncloud/ocdav/dav.go @@ -249,9 +249,7 @@ func (h *DavHandler) Handler(s *svc) http.Handler { } func getTokenStatInfo(ctx context.Context, client gatewayv1beta1.GatewayAPIClient, token string) (*provider.StatResponse, error) { - return client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: path.Join("/public", token)}, - }}) + return client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: path.Join("/public", token)}}) } func handleBasicAuth(ctx context.Context, c gatewayv1beta1.GatewayAPIClient, token, pw string) (*gatewayv1beta1.AuthenticateResponse, error) { diff --git a/internal/http/services/owncloud/ocdav/delete.go b/internal/http/services/owncloud/ocdav/delete.go index 0bdf55561a..8898a95d1a 100644 --- a/internal/http/services/owncloud/ocdav/delete.go +++ b/internal/http/services/owncloud/ocdav/delete.go @@ -44,9 +44,7 @@ func (s *svc) handleDelete(w http.ResponseWriter, r *http.Request, ns string) { return } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.DeleteRequest{Ref: ref} res, err := client.Delete(ctx, req) if err != nil { diff --git a/internal/http/services/owncloud/ocdav/get.go b/internal/http/services/owncloud/ocdav/get.go index d6ab7d6c89..d462d8fa1c 100644 --- a/internal/http/services/owncloud/ocdav/get.go +++ b/internal/http/services/owncloud/ocdav/get.go @@ -55,9 +55,7 @@ func (s *svc) handleGet(w http.ResponseWriter, r *http.Request, ns string) { } sReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, } sRes, err := client.Stat(ctx, sReq) if err != nil { @@ -79,9 +77,7 @@ func (s *svc) handleGet(w http.ResponseWriter, r *http.Request, ns string) { } dReq := &provider.InitiateFileDownloadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, } dRes, err := client.InitiateFileDownload(ctx, dReq) diff --git a/internal/http/services/owncloud/ocdav/head.go b/internal/http/services/owncloud/ocdav/head.go index 250da299bb..f70d4b95d8 100644 --- a/internal/http/services/owncloud/ocdav/head.go +++ b/internal/http/services/owncloud/ocdav/head.go @@ -50,9 +50,7 @@ func (s *svc) handleHead(w http.ResponseWriter, r *http.Request, ns string) { return } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{Ref: ref} res, err := client.Stat(ctx, req) if err != nil { diff --git a/internal/http/services/owncloud/ocdav/mkcol.go b/internal/http/services/owncloud/ocdav/mkcol.go index c93a8f9f67..889598a43b 100644 --- a/internal/http/services/owncloud/ocdav/mkcol.go +++ b/internal/http/services/owncloud/ocdav/mkcol.go @@ -54,9 +54,7 @@ func (s *svc) handleMkcol(w http.ResponseWriter, r *http.Request, ns string) { } // check fn exists - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} statReq := &provider.StatRequest{Ref: ref} statRes, err := client.Stat(ctx, statReq) if err != nil { diff --git a/internal/http/services/owncloud/ocdav/move.go b/internal/http/services/owncloud/ocdav/move.go index 77debda500..e92bc1bede 100644 --- a/internal/http/services/owncloud/ocdav/move.go +++ b/internal/http/services/owncloud/ocdav/move.go @@ -67,9 +67,7 @@ func (s *svc) handleMove(w http.ResponseWriter, r *http.Request, ns string) { // check src exists srcStatReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: src}, - }, + Ref: &provider.Reference{Path: src}, } srcStatRes, err := client.Stat(ctx, srcStatReq) if err != nil { @@ -83,9 +81,7 @@ func (s *svc) handleMove(w http.ResponseWriter, r *http.Request, ns string) { } // check dst exists - dstStatRef := &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - } + dstStatRef := &provider.Reference{Path: dst} dstStatReq := &provider.StatRequest{Ref: dstStatRef} dstStatRes, err := client.Stat(ctx, dstStatReq) if err != nil { @@ -124,9 +120,7 @@ func (s *svc) handleMove(w http.ResponseWriter, r *http.Request, ns string) { } else { // check if an intermediate path / the parent exists intermediateDir := path.Dir(dst) - ref2 := &provider.Reference{ - Spec: &provider.Reference_Path{Path: intermediateDir}, - } + ref2 := &provider.Reference{Path: intermediateDir} intStatReq := &provider.StatRequest{Ref: ref2} intStatRes, err := client.Stat(ctx, intStatReq) if err != nil { @@ -147,12 +141,8 @@ func (s *svc) handleMove(w http.ResponseWriter, r *http.Request, ns string) { // TODO what if intermediate is a file? } - sourceRef := &provider.Reference{ - Spec: &provider.Reference_Path{Path: src}, - } - dstRef := &provider.Reference{ - Spec: &provider.Reference_Path{Path: dst}, - } + sourceRef := &provider.Reference{Path: src} + dstRef := &provider.Reference{Path: dst} mReq := &provider.MoveRequest{Source: sourceRef, Destination: dstRef} mRes, err := client.Move(ctx, mReq) if err != nil { diff --git a/internal/http/services/owncloud/ocdav/propfind.go b/internal/http/services/owncloud/ocdav/propfind.go index 71eb313918..9e71d6b036 100644 --- a/internal/http/services/owncloud/ocdav/propfind.go +++ b/internal/http/services/owncloud/ocdav/propfind.go @@ -110,9 +110,7 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string) } } } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} req := &provider.StatRequest{ Ref: ref, ArbitraryMetadataKeys: metadataKeys, @@ -155,9 +153,7 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string) for len(stack) > 0 { // retrieve path on top of stack path := stack[len(stack)-1] - ref = &provider.Reference{ - Spec: &provider.Reference_Path{Path: path}, - } + ref = &provider.Reference{Path: path} req := &provider.ListContainerRequest{ Ref: ref, ArbitraryMetadataKeys: metadataKeys, diff --git a/internal/http/services/owncloud/ocdav/proppatch.go b/internal/http/services/owncloud/ocdav/proppatch.go index a8fe5933a0..f7dd927743 100644 --- a/internal/http/services/owncloud/ocdav/proppatch.go +++ b/internal/http/services/owncloud/ocdav/proppatch.go @@ -63,9 +63,7 @@ func (s *svc) handleProppatch(w http.ResponseWriter, r *http.Request, ns string) // check if resource exists statReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, } statRes, err := c.Stat(ctx, statReq) if err != nil { @@ -80,15 +78,11 @@ func (s *svc) handleProppatch(w http.ResponseWriter, r *http.Request, ns string) } rreq := &provider.UnsetArbitraryMetadataRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, ArbitraryMetadataKeys: []string{""}, } sreq := &provider.SetArbitraryMetadataRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, ArbitraryMetadata: &provider.ArbitraryMetadata{ Metadata: map[string]string{}, }, diff --git a/internal/http/services/owncloud/ocdav/put.go b/internal/http/services/owncloud/ocdav/put.go index 71a8c1b7b3..7a9ad49963 100644 --- a/internal/http/services/owncloud/ocdav/put.go +++ b/internal/http/services/owncloud/ocdav/put.go @@ -156,9 +156,7 @@ func (s *svc) handlePutHelper(w http.ResponseWriter, r *http.Request, content io return } - ref := &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - } + ref := &provider.Reference{Path: fn} sReq := &provider.StatRequest{Ref: ref} sRes, err := client.Stat(ctx, sReq) if err != nil { @@ -315,13 +313,7 @@ func (s *svc) handlePutHelper(w http.ResponseWriter, r *http.Request, content io w.WriteHeader(http.StatusInternalServerError) return } - sReq = &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: chunk.Path, - }, - }, - } + sReq = &provider.StatRequest{Ref: &provider.Reference{Path: chunk.Path}} } // stat again to check the new file's metadata diff --git a/internal/http/services/owncloud/ocdav/trashbin.go b/internal/http/services/owncloud/ocdav/trashbin.go index c97353c76f..cbc992f922 100644 --- a/internal/http/services/owncloud/ocdav/trashbin.go +++ b/internal/http/services/owncloud/ocdav/trashbin.go @@ -179,13 +179,7 @@ func (h *TrashbinHandler) listTrashbin(w http.ResponseWriter, r *http.Request, s // ask gateway for recycle items // TODO(labkode): add Reference to ListRecycleRequest - getRecycleRes, err := gc.ListRecycle(ctx, &gateway.ListRecycleRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, - }, - }) + getRecycleRes, err := gc.ListRecycle(ctx, &gateway.ListRecycleRequest{Ref: &provider.Reference{Path: getHomeRes.Path}}) if err != nil { sublog.Error().Err(err).Msg("error calling ListRecycle") @@ -285,8 +279,8 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, u *use Prop: []*propertyXML{}, }) // yes this is redundant, can be derived from oc:trashbin-original-location which contains the full path, clients should not fetch it - response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-original-filename", filepath.Base(item.Path))) - response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-original-location", strings.TrimPrefix(item.Path, "/"))) + response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-original-filename", filepath.Base(item.Ref.Path))) + response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-original-location", strings.TrimPrefix(item.Ref.Path, "/"))) response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-delete-timestamp", strconv.FormatUint(item.DeletionTime.Seconds, 10))) response.Propstat[0].Prop = append(response.Propstat[0].Prop, s.newProp("oc:trashbin-delete-datetime", dTime)) if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { @@ -322,10 +316,10 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, u *use } case "trashbin-original-filename": // yes this is redundant, can be derived from oc:trashbin-original-location which contains the full path, clients should not fetch it - propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:trashbin-original-filename", filepath.Base(item.Path))) + propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:trashbin-original-filename", filepath.Base(item.Ref.Path))) case "trashbin-original-location": // TODO (jfd) double check and clarify the cs3 spec what the Key is about and if Path is only the folder that contains the file or if it includes the filename - propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:trashbin-original-location", strings.TrimPrefix(item.Path, "/"))) + propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:trashbin-original-location", strings.TrimPrefix(item.Ref.Path, "/"))) case "trashbin-delete-datetime": propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:trashbin-delete-datetime", dTime)) case "trashbin-delete-timestamp": @@ -400,12 +394,10 @@ func (h *TrashbinHandler) restore(w http.ResponseWriter, r *http.Request, s *svc // use the key which is prefixed with the StoragePath to lookup the correct storage ... // TODO currently limited to the home storage Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, + Path: getHomeRes.Path, }, - Key: key, - RestorePath: dst, + Key: key, + RestoreRef: &provider.Reference{Path: dst}, } res, err := client.RestoreRecycleItem(ctx, req) @@ -447,13 +439,7 @@ func (h *TrashbinHandler) delete(w http.ResponseWriter, r *http.Request, s *svc, HandleErrorStatus(&sublog, w, getHomeRes.Status) return } - sRes, err := client.Stat(ctx, &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, - }, - }) + sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{Path: getHomeRes.Path}}) if err != nil { sublog.Error().Err(err).Msg("error calling Stat") w.WriteHeader(http.StatusInternalServerError) @@ -469,11 +455,9 @@ func (h *TrashbinHandler) delete(w http.ResponseWriter, r *http.Request, s *svc, req := &gateway.PurgeRecycleRequest{ Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: &provider.ResourceId{ - OpaqueId: key, - StorageId: sRes.Info.Id.StorageId, - }, + ResourceId: &provider.ResourceId{ + StorageId: sRes.Info.Id.StorageId, + OpaqueId: key, }, }, } diff --git a/internal/http/services/owncloud/ocdav/tus.go b/internal/http/services/owncloud/ocdav/tus.go index fec279f494..8fb4c7a1a1 100644 --- a/internal/http/services/owncloud/ocdav/tus.go +++ b/internal/http/services/owncloud/ocdav/tus.go @@ -84,9 +84,7 @@ func (s *svc) handleTusPost(w http.ResponseWriter, r *http.Request, ns string) { } sReq := &provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, } sRes, err := client.Stat(ctx, sReq) if err != nil { @@ -136,9 +134,7 @@ func (s *svc) handleTusPost(w http.ResponseWriter, r *http.Request, ns string) { // initiateUpload uReq := &provider.InitiateFileUploadRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{Path: fn}, - }, + Ref: &provider.Reference{Path: fn}, Opaque: &typespb.Opaque{ Map: opaqueMap, }, diff --git a/internal/http/services/owncloud/ocdav/versions.go b/internal/http/services/owncloud/ocdav/versions.go index bd261594ae..af3644cbdf 100644 --- a/internal/http/services/owncloud/ocdav/versions.go +++ b/internal/http/services/owncloud/ocdav/versions.go @@ -46,7 +46,7 @@ func (h *VersionsHandler) Handler(s *svc, rid *provider.ResourceId) http.Handler return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() - if rid == (*provider.ResourceId)(nil) { + if rid == nil { http.Error(w, "404 Not Found", http.StatusNotFound) return } @@ -99,11 +99,8 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, return } - ref := &provider.Reference{ - Spec: &provider.Reference_Id{Id: rid}, - } - req := &provider.StatRequest{Ref: ref} - res, err := client.Stat(ctx, req) + ref := &provider.Reference{ResourceId: rid} + res, err := client.Stat(ctx, &provider.StatRequest{Ref: ref}) if err != nil { sublog.Error().Err(err).Msg("error sending a grpc stat request") w.WriteHeader(http.StatusInternalServerError) @@ -116,10 +113,7 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, info := res.Info - lvReq := &provider.ListFileVersionsRequest{ - Ref: ref, - } - lvRes, err := client.ListFileVersions(ctx, lvReq) + lvRes, err := client.ListFileVersions(ctx, &provider.ListFileVersionsRequest{Ref: ref}) if err != nil { sublog.Error().Err(err).Msg("error sending list container grpc request") w.WriteHeader(http.StatusInternalServerError) @@ -143,7 +137,7 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, // Opaque Type: provider.ResourceType_RESOURCE_TYPE_FILE, Id: &provider.ResourceId{ - StorageId: "versions", // this is a virtual storage + StorageId: "versions", OpaqueId: info.Id.OpaqueId + "@" + versions[i].GetKey(), }, // Checksum @@ -193,9 +187,7 @@ func (h *VersionsHandler) doRestore(w http.ResponseWriter, r *http.Request, s *s } req := &provider.RestoreFileVersionRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{Id: rid}, - }, + Ref: &provider.Reference{ResourceId: rid}, Key: key, } diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go index 5c8029f4a1..5e5115e23e 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go @@ -377,13 +377,7 @@ func (h *Handler) updatePublicShare(w http.ResponseWriter, r *http.Request, shar return } - statReq := provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: before.Share.ResourceId, - }, - }, - } + statReq := provider.StatRequest{Ref: &provider.Reference{ResourceId: before.Share.ResourceId}} statRes, err := gwC.Stat(r.Context(), &statReq) if err != nil { diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index fefe0acad2..624df6bcf9 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -52,6 +52,7 @@ import ( "github.com/cs3org/reva/pkg/rhttp/router" "github.com/cs3org/reva/pkg/share/cache" "github.com/cs3org/reva/pkg/share/cache/registry" + "github.com/cs3org/reva/pkg/utils" "github.com/pkg/errors" ) @@ -217,11 +218,7 @@ func (h *Handler) createShare(w http.ResponseWriter, r *http.Request) { fn := path.Join(h.homeNamespace, r.FormValue("path")) statReq := provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: fn, - }, - }, + Ref: &provider.Reference{Path: fn}, } sublog := appctx.GetLogger(ctx).With().Str("path", fn).Logger() @@ -509,13 +506,9 @@ func (h *Handler) updateShare(w http.ResponseWriter, r *http.Request, shareID st return } - statReq := provider.StatRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: uRes.Share.ResourceId, - }, - }, - } + statReq := provider.StatRequest{Ref: &provider.Reference{ + ResourceId: uRes.Share.ResourceId, + }} statRes, err := client.Stat(r.Context(), &statReq) if err != nil { @@ -625,8 +618,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { var info *provider.ResourceInfo if pinfo != nil { // check if the shared resource matches the path resource - if rs.Share.ResourceId.StorageId != pinfo.GetId().StorageId || - rs.Share.ResourceId.OpaqueId != pinfo.GetId().OpaqueId { + if !utils.ResourceIDEqual(rs.Share.ResourceId, pinfo.Id) { // try next share continue } @@ -795,7 +787,7 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf } s.MimeType = parsedMt // TODO STime: &types.Timestamp{Seconds: info.Mtime.Seconds, Nanos: info.Mtime.Nanos}, - s.StorageID = info.Id.StorageId + s.StorageID = info.Id.StorageId + "!" + info.Id.OpaqueId // TODO Storage: int s.ItemSource = wrapResourceID(info.Id) s.FileSource = s.ItemSource @@ -943,18 +935,12 @@ func (h *Handler) getAdditionalInfoAttribute(ctx context.Context, u *userIdentif func (h *Handler) getResourceInfoByPath(ctx context.Context, client gateway.GatewayAPIClient, path string) (*provider.ResourceInfo, *rpc.Status, error) { return h.getResourceInfo(ctx, client, path, &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: path, - }, + Path: path, }) } func (h *Handler) getResourceInfoByID(ctx context.Context, client gateway.GatewayAPIClient, id *provider.ResourceId) (*provider.ResourceInfo, *rpc.Status, error) { - return h.getResourceInfo(ctx, client, wrapResourceID(id), &provider.Reference{ - Spec: &provider.Reference_Id{ - Id: id, - }, - }) + return h.getResourceInfo(ctx, client, wrapResourceID(id), &provider.Reference{ResourceId: id}) } // getResourceInfo retrieves the resource info to a target. diff --git a/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go b/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go index 89538d075e..37f6232784 100644 --- a/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go +++ b/internal/http/services/owncloud/ocs/handlers/cloud/users/users.go @@ -126,13 +126,7 @@ func (h *Handler) handleUsers(w http.ResponseWriter, r *http.Request, u *userpb. return } - getQuotaRes, err := gc.GetQuota(ctx, &gateway.GetQuotaRequest{ - Ref: &provider.Reference{ - Spec: &provider.Reference_Path{ - Path: getHomeRes.Path, - }, - }, - }) + getQuotaRes, err := gc.GetQuota(ctx, &gateway.GetQuotaRequest{Ref: &provider.Reference{Path: getHomeRes.Path}}) if err != nil { sublog.Error().Err(err).Msg("error calling GetQuota") w.WriteHeader(http.StatusInternalServerError) diff --git a/pkg/app/app.go b/pkg/app/app.go index 4adb0904dd..1534094f2d 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -40,5 +40,5 @@ type ProviderInfo struct { // Provider is the interface that application providers implement // for providing the iframe location to a iframe UI Provider type Provider interface { - GetIFrame(ctx context.Context, resID *provider.ResourceId, token string) (string, error) + GetIFrame(ctx context.Context, resID *provider.Reference, token string) (string, error) } diff --git a/pkg/app/provider/demo/demo.go b/pkg/app/provider/demo/demo.go index 928c602b1b..28134083e5 100644 --- a/pkg/app/provider/demo/demo.go +++ b/pkg/app/provider/demo/demo.go @@ -32,8 +32,8 @@ type provider struct { iframeUIProvider string } -func (p *provider) GetIFrame(ctx context.Context, resID *providerpb.ResourceId, token string) (string, error) { - msg := fmt.Sprintf("