From f756df07efa2e0ee0069a2da4db8b89783f09f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 26 May 2021 14:51:19 +0000 Subject: [PATCH] ResourceInfo.Ref -> ResourceInfo.Path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- cmd/reva/arguments.go | 2 +- cmd/reva/ls.go | 2 +- cmd/reva/ocm-share-create.go | 4 +- cmd/reva/transfer-create.go | 2 +- cmd/reva/upload.go | 2 +- examples/sdk/sdk.go | 8 +- go.sum | 4 +- internal/grpc/interceptors/auth/auth.go | 6 +- .../grpc/services/gateway/storageprovider.go | 86 +++++++++---------- .../services/gateway/usershareprovider.go | 2 +- .../services/gateway/webdavstorageprovider.go | 2 +- .../publicshareprovider.go | 2 +- .../publicstorageprovider.go | 4 +- .../storageprovider/storageprovider.go | 2 +- internal/http/services/owncloud/ocdav/copy.go | 8 +- internal/http/services/owncloud/ocdav/get.go | 2 +- .../http/services/owncloud/ocdav/propfind.go | 12 +-- .../services/owncloud/ocdav/publicfile.go | 4 +- .../http/services/owncloud/ocdav/versions.go | 4 +- .../handlers/apps/sharing/shares/pending.go | 4 +- .../handlers/apps/sharing/shares/remote.go | 2 +- .../handlers/apps/sharing/shares/shares.go | 8 +- pkg/cbox/share/sql/sql.go | 2 +- pkg/sdk/action/download.go | 2 +- pkg/sdk/action/enumfiles.go | 2 +- pkg/storage/fs/owncloud/owncloud.go | 2 +- pkg/storage/fs/s3/s3.go | 6 +- pkg/storage/utils/decomposedfs/node/node.go | 2 +- pkg/storage/utils/eosfs/eosfs.go | 8 +- pkg/storage/utils/etag/etag.go | 2 +- pkg/storage/utils/localfs/localfs.go | 2 +- .../integration/grpc/storageprovider_test.go | 2 +- 32 files changed, 101 insertions(+), 101 deletions(-) diff --git a/cmd/reva/arguments.go b/cmd/reva/arguments.go index ff049a748e3..7a9d442bb51 100644 --- a/cmd/reva/arguments.go +++ b/cmd/reva/arguments.go @@ -85,7 +85,7 @@ func (c *Completer) lsArgumentCompleter(onlyDirs bool) []prompt.Suggest { suggests = append(suggests, prompt.Suggest{Text: "/home"}) for _, r := range info { if !onlyDirs || r.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { - suggests = append(suggests, prompt.Suggest{Text: r.Ref.Path}) + suggests = append(suggests, prompt.Suggest{Text: r.Path.Path}) } } } diff --git a/cmd/reva/ls.go b/cmd/reva/ls.go index a5e72bae4b6..e65222ede67 100644 --- a/cmd/reva/ls.go +++ b/cmd/reva/ls.go @@ -66,7 +66,7 @@ func lsCommand() *command { infos := res.Infos for _, info := range infos { - p := info.Ref.Path + p := info.Path.Path if !*fullFlag { p = path.Base(p) } diff --git a/cmd/reva/ocm-share-create.go b/cmd/reva/ocm-share-create.go index ea90d0b33a4..ba1d3c938ed 100644 --- a/cmd/reva/ocm-share-create.go +++ b/cmd/reva/ocm-share-create.go @@ -124,14 +124,14 @@ func ocmShareCreateCommand() *command { }, "name": &types.OpaqueEntry{ Decoder: "plain", - Value: []byte(res.Info.Ref.Path), // TODO what reference should be used here? + Value: []byte(res.Info.Path.Path), // TODO what reference should be used here? }, }, } shareRequest := &ocm.CreateOCMShareRequest{ Opaque: opaqueObj, - Ref: res.Info.Ref, + Ref: res.Info.Path, Grant: grant, RecipientMeshProvider: providerInfo.ProviderInfo, } diff --git a/cmd/reva/transfer-create.go b/cmd/reva/transfer-create.go index 04140910feb..1c2ece9246f 100644 --- a/cmd/reva/transfer-create.go +++ b/cmd/reva/transfer-create.go @@ -114,7 +114,7 @@ func transferCreateCommand() *command { }, "name": &types.OpaqueEntry{ Decoder: "plain", - Value: []byte(statRes.Info.Ref.Path), + Value: []byte(statRes.Info.Path.Path), }, "protocol": &types.OpaqueEntry{ Decoder: "plain", diff --git a/cmd/reva/upload.go b/cmd/reva/upload.go index 25577b55d60..348e0f1fa46 100644 --- a/cmd/reva/upload.go +++ b/cmd/reva/upload.go @@ -221,7 +221,7 @@ func uploadCommand() *command { info := res2.Info - fmt.Printf("File uploaded: %s:%s %d %s\n", info.Id.StorageId, info.Id.NodeId, info.Size, info.Ref.Path) + fmt.Printf("File uploaded: %s:%s %d %s\n", info.Id.StorageId, info.Id.NodeId, info.Size, info.Path.Path) return nil } diff --git a/examples/sdk/sdk.go b/examples/sdk/sdk.go index 62b54c11fa9..078cedd7e02 100644 --- a/examples/sdk/sdk.go +++ b/examples/sdk/sdk.go @@ -54,7 +54,7 @@ func runActions(session *sdk.Session) { act := action.MustNewUploadAction(session) act.EnableTUS = true if info, err := act.UploadBytes([]byte("HELLO WORLD!\n"), "/home/subdir/tests.txt"); err == nil { - log.Printf("Uploaded file: %s [%db] -- %s", info.Ref.Path, info.Size, info.Type) + log.Printf("Uploaded file: %s [%db] -- %s", info.Path.Path, info.Size, info.Type) } else { log.Printf("Can't upload file: %v", err) } @@ -77,14 +77,14 @@ func runActions(session *sdk.Session) { act := action.MustNewEnumFilesAction(session) if files, err := act.ListFiles("/home", true); err == nil { for _, info := range files { - log.Printf("%s [%db] -- %s", info.Ref.Path, info.Size, info.Type) + log.Printf("%s [%db] -- %s", info.Path.Path, info.Size, info.Type) // Download the file actDl := action.MustNewDownloadAction(session) if data, err := actDl.Download(info); err == nil { - log.Printf("Downloaded %d bytes for '%v'", len(data), info.Ref.Path) + log.Printf("Downloaded %d bytes for '%v'", len(data), info.Path.Path) } else { - log.Printf("Unable to download data for '%v': %v", info.Ref.Path, err) + log.Printf("Unable to download data for '%v': %v", info.Path.Path, err) } log.Println("---") diff --git a/go.sum b/go.sum index d8b68bf77d1..8f18165fb17 100644 --- a/go.sum +++ b/go.sum @@ -1036,8 +1036,8 @@ github.com/prometheus/statsd_exporter v0.20.0 h1:M0hQphnq2WyWKS5CefQL8PqWwBOBPhi github.com/prometheus/statsd_exporter v0.20.0/go.mod h1:YL3FWCG8JBBtaUSxAg4Gz2ZYu22bS84XM89ZQXXTWmQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/refs/go-cs3apis v0.0.0-20210520134557-97cdc479815b h1:EQM9QE2M63TQNy4p/iqQqZAsFjTO8SDBy9ZHWpqqu4w= -github.com/refs/go-cs3apis v0.0.0-20210520134557-97cdc479815b/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= +github.com/refs/go-cs3apis v0.0.0-20210526140949-6696966c6248 h1:3mTgRQy5TjZ0tEV0n2ESGaSQIgrfbrHO/Ikg9iM7Ol8= +github.com/refs/go-cs3apis v0.0.0-20210526140949-6696966c6248/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= diff --git a/internal/grpc/interceptors/auth/auth.go b/internal/grpc/interceptors/auth/auth.go index 8b19d17d187..d1b5640f64a 100644 --- a/internal/grpc/interceptors/auth/auth.go +++ b/internal/grpc/interceptors/auth/auth.go @@ -261,9 +261,9 @@ func dismantleToken(ctx context.Context, tkn string, req interface{}, mgr token. return nil, err } - if ref.StorageId == statResponse.Info.Ref.StorageId && - ref.NodeId == statResponse.Info.Ref.NodeId && - strings.HasPrefix(ref.GetPath(), statResponse.Info.Ref.Path) { + if ref.StorageId == statResponse.Info.Path.StorageId && + ref.NodeId == statResponse.Info.Path.NodeId && + strings.HasPrefix(ref.GetPath(), statResponse.Info.Path.Path) { // The path corresponds to the resource to which the token has access. // We allow access to it. return u, nil diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index da7bf820c02..b6ebe13f97f 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -282,8 +282,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 = ri.Ref - log.Debug().Str("storage", ri.Ref.StorageId).Str("node", ri.Ref.NodeId).Str("path", ri.Ref.Path).Msg("download") + req.Ref = ri.Path + log.Debug().Str("storage", ri.Path.StorageId).Str("node", ri.Path.NodeId).Str("path", ri.Path.Path).Msg("download") return s.initiateFileDownload(ctx, req) } @@ -344,7 +344,7 @@ func (s *svc) InitiateFileDownload(ctx context.Context, req *provider.InitiateFi } // append child to target - req.Ref.Path = path.Join(ri.Ref.Path, shareChild) + req.Ref.Path = path.Join(ri.Path.Path, shareChild) log.Debug().Str("storage", req.Ref.StorageId).Str("node", req.Ref.NodeId).Str("path", req.Ref.Path).Msg("download") return s.initiateFileDownload(ctx, req) } @@ -481,7 +481,7 @@ 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 = ri.Ref + req.Ref = ri.Path log.Debug().Str("storage", req.Ref.StorageId).Str("node", req.Ref.NodeId).Str("path", req.Ref.Path).Msg("upload") return s.initiateFileUpload(ctx, req) } @@ -541,7 +541,7 @@ func (s *svc) InitiateFileUpload(ctx context.Context, req *provider.InitiateFile } // append child to target - req.Ref.Path = path.Join(ri.Ref.Path, shareChild) + req.Ref.Path = path.Join(ri.Path.Path, shareChild) return s.initiateFileUpload(ctx, req) } @@ -622,7 +622,7 @@ func (s *svc) GetPath(ctx context.Context, req *provider.GetPathRequest) (*provi return &provider.GetPathResponse{ Status: statRes.Status, - Ref: statRes.GetInfo().GetRef(), + Ref: statRes.GetInfo().GetPath(), }, nil } @@ -687,7 +687,7 @@ func (s *svc) CreateContainer(ctx context.Context, req *provider.CreateContainer } // append child to target - req.Ref.Path = path.Join(ri.Ref.Path, shareChild) + req.Ref.Path = path.Join(ri.Path.Path, shareChild) return s.createContainer(ctx, req) } @@ -789,7 +789,7 @@ func (s *svc) Delete(ctx context.Context, req *provider.DeleteRequest) (*provide } // append child to target - req.Ref.Path = path.Join(ri.Ref.Path, shareChild) + req.Ref.Path = path.Join(ri.Path.Path, shareChild) return s.delete(ctx, req) } @@ -887,14 +887,14 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo } src := &provider.Reference{ - StorageId: ri.Ref.StorageId, - NodeId: ri.Ref.NodeId, - Path: path.Join(ri.Ref.Path, shareChild), + StorageId: ri.Path.StorageId, + NodeId: ri.Path.NodeId, + Path: path.Join(ri.Path.Path, shareChild), } dst := &provider.Reference{ - StorageId: ri.Ref.StorageId, - NodeId: ri.Ref.NodeId, - Path: path.Join(ri.Ref.Path, dshareChild), + StorageId: ri.Path.StorageId, + NodeId: ri.Path.NodeId, + Path: path.Join(ri.Path.Path, dshareChild), } req.Source = src @@ -1007,7 +1007,7 @@ func (s *svc) statHome(ctx context.Context) (*provider.StatResponse, error) { }, nil } - if etagIface, err := s.etagCache.Get(statRes.Info.Owner.OpaqueId + ":" + statRes.Info.Ref.Path); err == nil { // FIXME @butonic REFERENCE also use node fo etag cache? + if etagIface, err := s.etagCache.Get(statRes.Info.Owner.OpaqueId + ":" + statRes.Info.Path.Path); err == nil { // FIXME @butonic REFERENCE also use node fo etag cache? resMtime := utils.TSToTime(statRes.Info.Mtime) resEtag := etagIface.(etagWithTS) // Use the updated etag if the home folder has been modified @@ -1017,7 +1017,7 @@ func (s *svc) statHome(ctx context.Context) (*provider.StatResponse, error) { } else { statRes.Info.Etag = etag.GenerateEtagFromResources(statRes.Info, []*provider.ResourceInfo{statSharedFolder.Info}) if s.c.EtagCacheTTL > 0 { - _ = s.etagCache.Set(statRes.Info.Owner.OpaqueId+":"+statRes.Info.Ref.Path, etagWithTS{statRes.Info.Etag, time.Now()}) // FIXME @butonic REFERENCE also use node fo etag cache? + _ = s.etagCache.Set(statRes.Info.Owner.OpaqueId+":"+statRes.Info.Path.Path, etagWithTS{statRes.Info.Etag, time.Now()}) // FIXME @butonic REFERENCE also use node fo etag cache? } } @@ -1050,7 +1050,7 @@ func (s *svc) statSharesFolder(ctx context.Context) (*provider.StatResponse, err }, nil } - if etagIface, err := s.etagCache.Get(statRes.Info.Owner.OpaqueId + ":" + statRes.Info.Ref.Path); err == nil { // FIXME @butonic REFERENCE also use node fo etag cache? + if etagIface, err := s.etagCache.Get(statRes.Info.Owner.OpaqueId + ":" + statRes.Info.Path.Path); err == nil { // FIXME @butonic REFERENCE also use node fo etag cache? resMtime := utils.TSToTime(statRes.Info.Mtime) resEtag := etagIface.(etagWithTS) // Use the updated etag if the shares folder has been modified, i.e., a new @@ -1061,7 +1061,7 @@ func (s *svc) statSharesFolder(ctx context.Context) (*provider.StatResponse, err } else { statRes.Info.Etag = etag.GenerateEtagFromResources(statRes.Info, lsRes.Infos) if s.c.EtagCacheTTL > 0 { - _ = s.etagCache.Set(statRes.Info.Owner.OpaqueId+":"+statRes.Info.Ref.Path, etagWithTS{statRes.Info.Etag, time.Now()}) // FIXME @butonic REFERENCE also use node fo etag cache? + _ = s.etagCache.Set(statRes.Info.Owner.OpaqueId+":"+statRes.Info.Path.Path, etagWithTS{statRes.Info.Etag, time.Now()}) // FIXME @butonic REFERENCE also use node fo etag cache? } } return statRes, nil @@ -1121,7 +1121,7 @@ func (s *svc) stat(ctx context.Context, req *provider.StatRequest) (*provider.St NodeId: uuid.New().String(), }, Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER, - Ref: &provider.Reference{Path: resPath}, // TODO this is an absolute path ... we should only return the name + Path: &provider.Reference{Path: resPath}, // TODO this is an absolute path ... we should only return the name Size: totalSize, }, }, nil @@ -1147,7 +1147,7 @@ func (s *svc) statOnProvider(ctx context.Context, req *provider.StatRequest, res } if res == nil { res = &provider.ResourceInfo{ - Ref: &provider.Reference{}, + Path: &provider.Reference{}, } } *res = *r.Info @@ -1208,9 +1208,9 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St // information. For example, if requests comes to: /home/MyShares/photos and photos // is reference to /user/peter/Holidays/photos, we need to still return to the user // /home/MyShares/photos - orgPath := statRes.Info.Ref.Path + orgPath := statRes.Info.Path.Path statRes.Info = ri - statRes.Info.Ref.Path = orgPath + statRes.Info.Path.Path = orgPath return statRes, nil } @@ -1246,7 +1246,7 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St Status: status.NewInternal(ctx, err, "gateway: error resolving webdav reference: "+p), }, nil } - ri.Ref.Path = p + ri.Path.Path = p return &provider.StatResponse{ Status: status.NewOK(ctx), Info: ri, @@ -1254,7 +1254,7 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St } // append child to target - req.Ref.Path = path.Join(ri.Ref.Path, shareChild) + req.Ref.Path = path.Join(ri.Path.Path, shareChild) res, err := s.stat(ctx, req) if err != nil { return &provider.StatResponse{ @@ -1269,7 +1269,7 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St // we need to make sure we don't expose the reference target in the resource // information. - res.Info.Ref.Path = p + res.Info.Path.Path = p return res, nil } @@ -1370,7 +1370,7 @@ func (s *svc) listHome(ctx context.Context, req *provider.ListContainerRequest) } for i := range lcr.Infos { - if s.isSharedFolder(ctx, lcr.Infos[i].Ref.Path) { + if s.isSharedFolder(ctx, lcr.Infos[i].Path.Path) { statSharedFolder, err := s.statSharesFolder(ctx) if err != nil { return &provider.ListContainerResponse{ @@ -1422,7 +1422,7 @@ func (s *svc) listSharesFolder(ctx context.Context) (*provider.ListContainerResp } } - info.Ref = lcr.Infos[i].Ref + info.Path = lcr.Infos[i].Path checkedInfos = append(checkedInfos, info) } lcr.Infos = checkedInfos @@ -1458,8 +1458,8 @@ func (s *svc) listContainer(ctx context.Context, req *provider.ListContainerRequ }, nil } for _, inf := range infoFromProviders[i] { - if parent := path.Dir(inf.Ref.Path); resPath != "" && resPath != parent { - parts := strings.Split(strings.TrimPrefix(inf.Ref.Path, resPath), "/") + if parent := path.Dir(inf.Path.Path); resPath != "" && resPath != parent { + parts := strings.Split(strings.TrimPrefix(inf.Path.Path, resPath), "/") p := path.Join(resPath, parts[1]) indirects[p] = append(indirects[p], inf) } else { @@ -1476,7 +1476,7 @@ func (s *svc) listContainer(ctx context.Context, req *provider.ListContainerRequ }, Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER, Etag: etag.GenerateEtagFromResources(nil, v), - Ref: &provider.Reference{Path: k}, + Path: &provider.Reference{Path: k}, Size: 0, } infos = append(infos, inf) @@ -1562,8 +1562,8 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } for _, info := range infos { - base := path.Base(info.Ref.Path) - info.Ref.Path = path.Join(p, base) + base := path.Base(info.Path.Path) + info.Path.Path = path.Join(p, base) } return &provider.ListContainerResponse{ Status: status.NewOK(ctx), @@ -1572,7 +1572,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } if ri.Type != provider.ResourceType_RESOURCE_TYPE_CONTAINER { - err := errtypes.NotSupported("gateway: list container: cannot list non-container type:" + ri.Ref.Path) + err := errtypes.NotSupported("gateway: list container: cannot list non-container type:" + ri.Path.Path) log.Err(err).Msg("gateway: error listing") return &provider.ListContainerResponse{ Status: status.NewInvalidArg(ctx, "resource is not a container"), @@ -1580,7 +1580,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } newReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{Path: ri.Ref.Path}, + Ref: &provider.Reference{Path: ri.Path.Path}, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, } newRes, err := s.listContainer(ctx, newReq) @@ -1598,8 +1598,8 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ // paths needs to be converted for _, info := range newRes.Infos { - base := path.Base(info.Ref.Path) - info.Ref.Path = path.Join(p, base) + base := path.Base(info.Path.Path) + info.Path.Path = path.Join(p, base) } return newRes, nil @@ -1639,8 +1639,8 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } for _, info := range infos { - base := path.Base(info.Ref.Path) - info.Ref.Path = path.Join(shareName, shareChild, base) + base := path.Base(info.Path.Path) + info.Path.Path = path.Join(shareName, shareChild, base) } return &provider.ListContainerResponse{ Status: status.NewOK(ctx), @@ -1649,7 +1649,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } if ri.Type != provider.ResourceType_RESOURCE_TYPE_CONTAINER { - err := errtypes.NotSupported("gateway: list container: cannot list non-container type:" + ri.Ref.Path) + err := errtypes.NotSupported("gateway: list container: cannot list non-container type:" + ri.Path.Path) log.Err(err).Msg("gateway: error listing") return &provider.ListContainerResponse{ Status: status.NewInvalidArg(ctx, "resource is not a container"), @@ -1657,7 +1657,7 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ } newReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{Path: path.Join(ri.Ref.Path, shareChild)}, + Ref: &provider.Reference{Path: path.Join(ri.Path.Path, shareChild)}, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, } newRes, err := s.listContainer(ctx, newReq) @@ -1675,8 +1675,8 @@ func (s *svc) ListContainer(ctx context.Context, req *provider.ListContainerRequ // paths needs to be converted for _, info := range newRes.Infos { - base := path.Base(info.Ref.Path) - info.Ref.Path = path.Join(shareName, shareChild, base) + base := path.Base(info.Path.Path) + info.Path.Path = path.Join(shareName, shareChild, base) } return newRes, nil @@ -1695,7 +1695,7 @@ func (s *svc) getPath(ctx context.Context, ref *provider.Reference, keys ...stri return "", res.Status } - return res.Info.Ref.Path, res.Status + return res.Info.Path.Path, res.Status } if ref.Path != "" { diff --git a/internal/grpc/services/gateway/usershareprovider.go b/internal/grpc/services/gateway/usershareprovider.go index 7d065dbf450..f1d28a18956 100644 --- a/internal/grpc/services/gateway/usershareprovider.go +++ b/internal/grpc/services/gateway/usershareprovider.go @@ -364,7 +364,7 @@ func (s *svc) createReference(ctx context.Context, resourceID *provider.Referenc // 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.Ref.Path, s.c.ShareFolder, path.Base(statRes.Info.Ref.Path)) + refPath := path.Join(homeRes.Ref.Path, s.c.ShareFolder, path.Base(statRes.Info.Path.Path)) log.Info().Msg("mount path will be:" + refPath) createRefReq := &provider.CreateReferenceRequest{ diff --git a/internal/grpc/services/gateway/webdavstorageprovider.go b/internal/grpc/services/gateway/webdavstorageprovider.go index 9d8069378c7..a9745956be9 100644 --- a/internal/grpc/services/gateway/webdavstorageprovider.go +++ b/internal/grpc/services/gateway/webdavstorageprovider.go @@ -255,7 +255,7 @@ func (s *svc) getWebdavEndpoint(ctx context.Context, domain string) (string, err func normalize(info *gowebdav.File) *provider.ResourceInfo { return &provider.ResourceInfo{ // TODO(ishank011): Add Id, PermissionSet, Owner - Ref: &provider.Reference{Path: info.Path()}, + Path: &provider.Reference{Path: info.Path()}, Type: getResourceType(info.IsDir()), Etag: info.ETag(), MimeType: info.ContentType(), diff --git a/internal/grpc/services/publicshareprovider/publicshareprovider.go b/internal/grpc/services/publicshareprovider/publicshareprovider.go index 3723a8e2ada..3b71d85e195 100644 --- a/internal/grpc/services/publicshareprovider/publicshareprovider.go +++ b/internal/grpc/services/publicshareprovider/publicshareprovider.go @@ -195,7 +195,7 @@ func (s *service) ListPublicShares(ctx context.Context, req *link.ListPublicShar log.Info().Str("publicshareprovider", "list").Msg("list public share") user, _ := user.ContextGetUser(ctx) - shares, err := s.sm.ListPublicShares(ctx, user, req.Filters, &provider.ResourceInfo{Ref: &provider.Reference{}}, req.GetSign()) + shares, err := s.sm.ListPublicShares(ctx, user, req.Filters, &provider.ResourceInfo{Path: &provider.Reference{}}, req.GetSign()) if err != nil { log.Err(err).Msg("error listing shares") return &link.ListPublicSharesResponse{ diff --git a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go index 5192669a45f..a6ca6ae6b78 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -483,7 +483,7 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide if err := addShare(statResponse.Info, ls); err != nil { appctx.GetLogger(ctx).Error().Err(err).Interface("share", ls).Interface("info", statResponse.Info).Msg("error when adding share") } - statResponse.Info.Ref.Path = path.Join(s.mountPath, "/", tkn, relativePath) + statResponse.Info.Path.Path = path.Join(s.mountPath, "/", tkn, relativePath) filterPermissions(statResponse.Info.PermissionSet, ls.GetPermissions().Permissions) } @@ -542,7 +542,7 @@ func (s *service) ListContainer(ctx context.Context, req *provider.ListContainer for i := range listContainerR.Infos { filterPermissions(listContainerR.Infos[i].PermissionSet, ls.GetPermissions().Permissions) - listContainerR.Infos[i].Ref.Path = path.Join(s.mountPath, "/", tkn, relativePath, path.Base(listContainerR.Infos[i].Ref.Path)) + listContainerR.Infos[i].Path.Path = path.Join(s.mountPath, "/", tkn, relativePath, path.Base(listContainerR.Infos[i].Path.Path)) if err := addShare(listContainerR.Infos[i], ls); err != nil { appctx.GetLogger(ctx).Error().Err(err).Interface("share", ls).Interface("info", listContainerR.Infos[i]).Msg("error when adding share") } diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 93db1779e9b..7f2582a2bf4 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -1129,6 +1129,6 @@ func (s *service) wrap(ctx context.Context, ri *provider.ResourceInfo) error { // For wrapper drivers, the storage ID might already be set. In that case, skip setting it ri.Id.StorageId = s.mountID } - ri.Ref.Path = path.Join(s.mountPath, ri.Ref.Path) // FIXME @butonic REFERENCE nooooo the provider should not know where it is mounted + ri.Path.Path = path.Join(s.mountPath, ri.Path.Path) // FIXME @butonic REFERENCE nooooo the provider should not know where it is mounted return nil } diff --git a/internal/http/services/owncloud/ocdav/copy.go b/internal/http/services/owncloud/ocdav/copy.go index de260b1a34b..9a519196216 100644 --- a/internal/http/services/owncloud/ocdav/copy.go +++ b/internal/http/services/owncloud/ocdav/copy.go @@ -154,7 +154,7 @@ func (s *svc) handleCopy(w http.ResponseWriter, r *http.Request, ns string) { func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src *provider.ResourceInfo, dst string, recurse bool) error { log := appctx.GetLogger(ctx) - log.Debug().Str("src", src.Ref.Path).Str("dst", dst).Msg("descending") + log.Debug().Str("src", src.Path.Path).Str("dst", dst).Msg("descending") if src.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { // create dir createReq := &provider.CreateContainerRequest{ @@ -173,7 +173,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src // descend for children listReq := &provider.ListContainerRequest{ - Ref: &provider.Reference{Path: src.Ref.Path}, + Ref: &provider.Reference{Path: src.Path.Path}, } res, err := client.ListContainer(ctx, listReq) if err != nil { @@ -184,7 +184,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src } for i := range res.Infos { - childDst := path.Join(dst, path.Base(res.Infos[i].Ref.Path)) + childDst := path.Join(dst, path.Base(res.Infos[i].Path.Path)) err := s.descend(ctx, client, res.Infos[i], childDst, recurse) if err != nil { return err @@ -197,7 +197,7 @@ func (s *svc) descend(ctx context.Context, client gateway.GatewayAPIClient, src // 1. get download url dReq := &provider.InitiateFileDownloadRequest{ - Ref: &provider.Reference{Path: src.Ref.Path}, + Ref: &provider.Reference{Path: src.Path.Path}, } dRes, err := client.InitiateFileDownload(ctx, dReq) diff --git a/internal/http/services/owncloud/ocdav/get.go b/internal/http/services/owncloud/ocdav/get.go index 00589d75df4..13e9b13c532 100644 --- a/internal/http/services/owncloud/ocdav/get.go +++ b/internal/http/services/owncloud/ocdav/get.go @@ -128,7 +128,7 @@ func (s *svc) handleGet(w http.ResponseWriter, r *http.Request, ns string) { w.Header().Set("Content-Type", info.MimeType) w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+ - path.Base(info.Ref.Path)+"; filename=\""+path.Base(info.Ref.Path)+"\"") + path.Base(info.Path.Path)+"; filename=\""+path.Base(info.Path.Path)+"\"") w.Header().Set("ETag", info.Etag) w.Header().Set("OC-FileId", wrapResourceID(info.Id)) w.Header().Set("OC-ETag", info.Etag) diff --git a/internal/http/services/owncloud/ocdav/propfind.go b/internal/http/services/owncloud/ocdav/propfind.go index df3a04b940d..76dd402f3ba 100644 --- a/internal/http/services/owncloud/ocdav/propfind.go +++ b/internal/http/services/owncloud/ocdav/propfind.go @@ -149,7 +149,7 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string) } else if depth == "infinity" { // FIXME: doesn't work cross-storage as the results will have the wrong paths! // use a stack to explore sub-containers breadth-first - stack := []string{info.Ref.Path} + stack := []string{info.Path.Path} for len(stack) > 0 { // retrieve path on top of stack path := stack[len(stack)-1] @@ -184,7 +184,7 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string) for i := len(res.Infos) - 1; i >= 0; i-- { // for i := range res.Infos { if res.Infos[i].Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { - stack = append(stack, res.Infos[i].Ref.Path) + stack = append(stack, res.Infos[i].Path.Path) } } } @@ -330,11 +330,11 @@ func (s *svc) newPropRaw(key, val string) *propertyXML { // prefixing it with the baseURI func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provider.ResourceInfo, ns string) (*responseXML, error) { sublog := appctx.GetLogger(ctx).With().Interface("md", md).Str("ns", ns).Logger() - md.Ref.Path = strings.TrimPrefix(md.Ref.Path, ns) + md.Path.Path = strings.TrimPrefix(md.Path.Path, ns) baseURI := ctx.Value(ctxKeyBaseURI).(string) - ref := path.Join(baseURI, md.Ref.Path) + ref := path.Join(baseURI, md.Path.Path) if md.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { ref += "/" } @@ -662,12 +662,12 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide if isPublic && md.Type == provider.ResourceType_RESOURCE_TYPE_FILE { var path string if !ls.PasswordProtected { - path = md.Ref.Path + path = md.Path.Path } else { expiration := time.Unix(int64(ls.Signature.SignatureExpiration.Seconds), int64(ls.Signature.SignatureExpiration.Nanos)) var sb strings.Builder - sb.WriteString(md.Ref.Path) + sb.WriteString(md.Path.Path) sb.WriteString("?signature=") sb.WriteString(ls.Signature.Signature) sb.WriteString("&expiration=") diff --git a/internal/http/services/owncloud/ocdav/publicfile.go b/internal/http/services/owncloud/ocdav/publicfile.go index 729cac9f460..ab0f1cb854b 100644 --- a/internal/http/services/owncloud/ocdav/publicfile.go +++ b/internal/http/services/owncloud/ocdav/publicfile.go @@ -184,7 +184,7 @@ func (s *svc) handlePropfindOnToken(w http.ResponseWriter, r *http.Request, ns s return } // adjust path - tokenStatInfo.Ref.Path = path.Join("/", tokenStatInfo.Ref.Path, path.Base(pathRes.Ref.Path)) + tokenStatInfo.Path.Path = path.Join("/", tokenStatInfo.Path.Path, path.Base(pathRes.Ref.Path)) infos := s.getPublicFileInfos(onContainer, depth == "0", tokenStatInfo) @@ -223,7 +223,7 @@ func (s *svc) getPublicFileInfos(onContainer, onlyRoot bool, i *provider.Resourc infos = append(infos, &provider.ResourceInfo{ // Opaque carries the link-share data we need when rendering the collection root href Opaque: o, - Ref: &provider.Reference{Path: path.Dir(i.Ref.Path)}, + Path: &provider.Reference{Path: path.Dir(i.Path.Path)}, Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER, }) if onlyRoot { diff --git a/internal/http/services/owncloud/ocdav/versions.go b/internal/http/services/owncloud/ocdav/versions.go index bf1849732d6..d439162d1b1 100644 --- a/internal/http/services/owncloud/ocdav/versions.go +++ b/internal/http/services/owncloud/ocdav/versions.go @@ -132,7 +132,7 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, // add version dir . entry, derived from file info infos = append(infos, &provider.ResourceInfo{ Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER, - Ref: &provider.Reference{}, + Path: &provider.Reference{}, }) for i := range versions { @@ -151,7 +151,7 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, Seconds: versions[i].Mtime, // TODO cs3apis FileVersion should use types.Timestamp instead of uint64 }, - Ref: &provider.Reference{Path: path.Join("v", versions[i].Key)}, + Path: &provider.Reference{Path: path.Join("v", versions[i].Key)}, // PermissionSet Size: versions[i].Size, Owner: info.Owner, diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go index 32c75f33635..431703e039c 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/pending.go @@ -111,8 +111,8 @@ func (h *Handler) updateReceivedShare(w http.ResponseWriter, r *http.Request, sh // But if a request DOES use an id, the Ref contains the same id? at least in the Ref part of the ResouceInfo // In the Id of a Resoucre info the storageid and node id are always set. // so ... if info.Ref.StorageId != "" -> use /dav/spaces path, otherwise use path and append it to webdav endpoint - data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Ref.Path)) // FIXME @butonic REFERENCES use same "wrong" path!!!! - data.Path = path.Join(h.sharePrefix, path.Base(info.Ref.Path)) + data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path.Path)) // FIXME @butonic REFERENCES use same "wrong" path!!!! + data.Path = path.Join(h.sharePrefix, path.Base(info.Path.Path)) } response.WriteOCSSuccess(w, r, []*conversions.ShareData{data}) diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go index 3d75e305e24..3b7d3172ad5 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/remote.go @@ -85,7 +85,7 @@ func (h *Handler) createFederatedCloudShare(w http.ResponseWriter, r *http.Reque }, "name": { Decoder: "plain", - Value: []byte(statInfo.Ref.Path), + Value: []byte(statInfo.Path.Path), }, }, }, 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 cfa53438942..7bb3f6b91c7 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 @@ -647,8 +647,8 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { if data.State == ocsStateAccepted { // Needed because received shares can be jailed in a folder in the users home - data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Ref.Path)) - data.Path = path.Join(h.sharePrefix, path.Base(info.Ref.Path)) + data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path.Path)) + data.Path = path.Join(h.sharePrefix, path.Base(info.Path.Path)) } shares = append(shares, data) @@ -789,8 +789,8 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf // TODO Storage: int s.ItemSource = wrapResourceID(info.Id) s.FileSource = s.ItemSource - s.FileTarget = path.Join("/", path.Base(info.Ref.Path)) - s.Path = path.Join("/", path.Base(info.Ref.Path)) // TODO hm this might have to be relative to the users home ... depends on the webdav_namespace config + s.FileTarget = path.Join("/", path.Base(info.Path.Path)) + s.Path = path.Join("/", path.Base(info.Path.Path)) // TODO hm this might have to be relative to the users home ... depends on the webdav_namespace config // TODO FileParent: // item type s.ItemType = conversions.ResourceType(info.GetType()).String() diff --git a/pkg/cbox/share/sql/sql.go b/pkg/cbox/share/sql/sql.go index d2e946a8126..5b9ffb85113 100644 --- a/pkg/cbox/share/sql/sql.go +++ b/pkg/cbox/share/sql/sql.go @@ -117,7 +117,7 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceInfo, g *collabora shareType, shareWith := conversions.FormatGrantee(g.Grantee) itemType := conversions.ResourceTypeToItem(md.Type) - targetPath := path.Join("/", path.Base(md.Ref.Path)) + targetPath := path.Join("/", path.Base(md.Path.Path)) permissions := conversions.SharePermToInt(g.Permissions.Permissions) prefix := md.Id.StorageId itemSource := md.Id.NodeId diff --git a/pkg/sdk/action/download.go b/pkg/sdk/action/download.go index 1a7bb490921..1dcbde25ffc 100644 --- a/pkg/sdk/action/download.go +++ b/pkg/sdk/action/download.go @@ -89,7 +89,7 @@ func (action *DownloadAction) Download(fileInfo *storage.ResourceInfo) ([]byte, func (action *DownloadAction) initiateDownload(fileInfo *storage.ResourceInfo) (*gateway.InitiateFileDownloadResponse, error) { // Initiating a download request gets us the download endpoint for the specified resource - req := &provider.InitiateFileDownloadRequest{Ref: fileInfo.Ref} + req := &provider.InitiateFileDownloadRequest{Ref: fileInfo.Path} res, err := action.session.Client().InitiateFileDownload(action.session.Context(), req) if err := net.CheckRPCInvocation("initiating download", res, err); err != nil { return nil, err diff --git a/pkg/sdk/action/enumfiles.go b/pkg/sdk/action/enumfiles.go index b76c4084bac..554da7d0b8b 100644 --- a/pkg/sdk/action/enumfiles.go +++ b/pkg/sdk/action/enumfiles.go @@ -51,7 +51,7 @@ func (action *EnumFilesAction) ListAll(path string, includeSubdirectories bool) fileList = append(fileList, fi) if fi.Type == storage.ResourceType_RESOURCE_TYPE_CONTAINER && includeSubdirectories { - subFileList, err := action.ListAll(fi.Ref.Path, includeSubdirectories) // TODO @butonic REFERENCE path based walking ? + subFileList, err := action.ListAll(fi.Path.Path, includeSubdirectories) // TODO @butonic REFERENCE path based walking ? if err != nil { return nil, err } diff --git a/pkg/storage/fs/owncloud/owncloud.go b/pkg/storage/fs/owncloud/owncloud.go index a66b627544b..0922543a144 100644 --- a/pkg/storage/fs/owncloud/owncloud.go +++ b/pkg/storage/fs/owncloud/owncloud.go @@ -665,7 +665,7 @@ func (fs *ocfs) convertToResourceInfo(ctx context.Context, fi os.FileInfo, ip st StorageId: "", // FIXME @butonic use root node id? NodeId: id, }, - Ref: &provider.Reference{Path: sp}, // Todo and + Path: &provider.Reference{Path: sp}, // Todo and Type: getResourceType(fi.IsDir()), Etag: etag, MimeType: mime.Detect(fi.IsDir(), ip), diff --git a/pkg/storage/fs/s3/s3.go b/pkg/storage/fs/s3/s3.go index bf5f6a51efd..47003a5eea7 100644 --- a/pkg/storage/fs/s3/s3.go +++ b/pkg/storage/fs/s3/s3.go @@ -176,7 +176,7 @@ func (fs *s3FS) normalizeObject(ctx context.Context, o *s3.Object, fn string) *p // FIXME @butonic REFERENCE add storageid NodeId: "fileid-" + strings.TrimPrefix(fn, "/"), }, - Ref: &provider.Reference{Path: fn}, + Path: &provider.Reference{Path: fn}, Type: getResourceType(isDir), Etag: *o.ETag, MimeType: mime.Detect(isDir, fn), @@ -208,7 +208,7 @@ func (fs *s3FS) normalizeHead(ctx context.Context, o *s3.HeadObjectOutput, fn st // FIXME @butonic REFERENCE add storageid NodeId: "fileid-" + strings.TrimPrefix(fn, "/"), }, - Ref: &provider.Reference{Path: fn}, + Path: &provider.Reference{Path: fn}, Type: getResourceType(isDir), Etag: *o.ETag, MimeType: mime.Detect(isDir, fn), @@ -231,7 +231,7 @@ func (fs *s3FS) normalizeCommonPrefix(ctx context.Context, p *s3.CommonPrefix) * // FIXME @butonic REFERENCE add storageid NodeId: "fileid-" + strings.TrimPrefix(fn, "/"), }, - Ref: &provider.Reference{Path: fn}, + Path: &provider.Reference{Path: fn}, Type: getResourceType(true), Etag: "TODO(labkode)", MimeType: mime.Detect(true, fn), diff --git a/pkg/storage/utils/decomposedfs/node/node.go b/pkg/storage/utils/decomposedfs/node/node.go index fe77d4bec8a..dea4f6c6bf4 100644 --- a/pkg/storage/utils/decomposedfs/node/node.go +++ b/pkg/storage/utils/decomposedfs/node/node.go @@ -454,7 +454,7 @@ func (n *Node) AsResourceInfo(ctx context.Context, rp *provider.ResourcePermissi // FIXME @butonic REFERENCE add storage id NodeId: n.ID, }, - Ref: &provider.Reference{ + Path: &provider.Reference{ // FIXME @butonic REFERENCE return StorageId, NodeId and relative path if request contains ids Path: fn, }, diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 4c7ec55993a..b35c1b098e1 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -667,7 +667,7 @@ func (fs *eosfs) listWithNominalHome(ctx context.Context, p string) (finfos []*p } // Remove the hidden folders in the topmost directory - if finfo, err := fs.convertToResourceInfo(ctx, eosFileInfo, virtualView); err == nil && finfo.Ref.Path != "/" && !strings.HasPrefix(finfo.Ref.Path, "/.") { + if finfo, err := fs.convertToResourceInfo(ctx, eosFileInfo, virtualView); err == nil && finfo.Path.Path != "/" && !strings.HasPrefix(finfo.Path.Path, "/.") { finfos = append(finfos, finfo) } } @@ -721,7 +721,7 @@ func (fs *eosfs) listHome(ctx context.Context, home string) ([]*provider.Resourc } } - if finfo, err := fs.convertToResourceInfo(ctx, eosFileInfo, false); err == nil && finfo.Ref.Path != "/" && !strings.HasPrefix(finfo.Ref.Path, "/.") { + if finfo, err := fs.convertToResourceInfo(ctx, eosFileInfo, false); err == nil && finfo.Path.Path != "/" && !strings.HasPrefix(finfo.Path.Path, "/.") { finfos = append(finfos, finfo) } } @@ -1331,7 +1331,7 @@ func (fs *eosfs) convertToRevision(ctx context.Context, eosFileInfo *eosclient.F return nil, err } revision := &provider.FileVersion{ - Key: path.Base(md.Ref.Path), + Key: path.Base(md.Path.Path), Size: md.Size, Mtime: md.Mtime.Seconds, // TODO do we need nanos here? Etag: md.Etag, @@ -1459,7 +1459,7 @@ func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo, v // FIXME @butonic REFERENCE also return StorageId NodeId: fmt.Sprintf("%d", eosFileInfo.Inode), }, - Ref: &provider.Reference{ + Path: &provider.Reference{ // FIXME @butonic REFERENCE return StorageId, NodeId and relative path if request contains ids Path: path, }, diff --git a/pkg/storage/utils/etag/etag.go b/pkg/storage/utils/etag/etag.go index d1bfe36c99e..11b24116905 100644 --- a/pkg/storage/utils/etag/etag.go +++ b/pkg/storage/utils/etag/etag.go @@ -69,7 +69,7 @@ func GenerateEtagFromResources(root *provider.ResourceInfo, children []*provider func combineEtags(resources []*provider.ResourceInfo) string { sort.SliceStable(resources, func(i, j int) bool { - return resources[i].Ref.Path < resources[j].Ref.Path + return resources[i].Path.Path < resources[j].Path.Path }) h := md5.New() diff --git a/pkg/storage/utils/localfs/localfs.go b/pkg/storage/utils/localfs/localfs.go index eeecdf90aa2..0876d8e3925 100644 --- a/pkg/storage/utils/localfs/localfs.go +++ b/pkg/storage/utils/localfs/localfs.go @@ -345,7 +345,7 @@ func (fs *localfs) normalize(ctx context.Context, fi os.FileInfo, fn string, mdK // FIXME @butonic REFERENCE also return StorageId and NodeId NodeId: "fileid-" + url.QueryEscape(path.Join(layout, fp)), }, - Ref: &provider.Reference{ + Path: &provider.Reference{ // FIXME @butonic REFERENCE return StorageId, NodeId and relative path if request contains ids Path: fp, }, diff --git a/tests/integration/grpc/storageprovider_test.go b/tests/integration/grpc/storageprovider_test.go index a66af10f3c4..ab745ceb710 100644 --- a/tests/integration/grpc/storageprovider_test.go +++ b/tests/integration/grpc/storageprovider_test.go @@ -148,7 +148,7 @@ var _ = Describe("storage providers", func() { info := listRes.Infos[0] Expect(info.Type).To(Equal(storagep.ResourceType_RESOURCE_TYPE_CONTAINER)) - Expect(info.Ref.Path).To(Equal(subdirPath)) + Expect(info.Path.Path).To(Equal(subdirPath)) Expect(info.Owner.OpaqueId).To(Equal("f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c")) }) }