@cryptotaxi247 / kubo / commits / 4f6069f21

cmds/refs: fix ipfs refs for sharded directories

fixes #6596

Steven Allen committed Aug 21, 2019 at 18:25 UTC 4f6069f2183ad99b87ca227fdd0f731e3528a5a9
2 files changed +7 -14
core/commands/refs.go
+7 -13
@@ -7,15 +7,14 @@ import (
7 "io"
8 "strings"
9
10 - core "github.com/ipfs/go-ipfs/core"
10 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
12 - "github.com/ipfs/go-ipfs/namesys/resolve"
11
12 cid "github.com/ipfs/go-cid"
13 cidenc "github.com/ipfs/go-cidutil/cidenc"
14 cmds "github.com/ipfs/go-ipfs-cmds"
15 ipld "github.com/ipfs/go-ipld-format"
18 - path "github.com/ipfs/go-path"
16 + iface "github.com/ipfs/interface-go-ipfs-core"
17 + path "github.com/ipfs/interface-go-ipfs-core/path"
18 )
19
20 var refsEncoderMap = cmds.EncoderMap{
@@ -75,7 +74,7 @@ NOTE: List all references recursively by using the flag '-r'.
74 }
75
76 ctx := req.Context
78 - n, err := cmdenv.GetNode(env)
77 + api, err := cmdenv.GetApi(env, req)
78 if err != nil {
79 return err
80 }
@@ -103,14 +102,14 @@ NOTE: List all references recursively by using the flag '-r'.
102 format = "<src> -> <dst>"
103 }
104
106 - objs, err := objectsForPaths(ctx, n, req.Arguments)
105 + objs, err := objectsForPaths(ctx, api, req.Arguments)
106 if err != nil {
107 return err
108 }
109
110 rw := RefWriter{
111 res: res,
113 - DAG: n.DAG,
112 + DAG: api.Dag(),
113 Ctx: ctx,
114 Unique: unique,
115 PrintFmt: format,
@@ -165,15 +164,10 @@ Displays the hashes of all local objects.
164 Type: RefWrapper{},
165 }
166
168 -func objectsForPaths(ctx context.Context, n *core.IpfsNode, paths []string) ([]ipld.Node, error) {
167 +func objectsForPaths(ctx context.Context, n iface.CoreAPI, paths []string) ([]ipld.Node, error) {
168 objects := make([]ipld.Node, len(paths))
169 for i, sp := range paths {
171 - p, err := path.ParsePath(sp)
172 - if err != nil {
173 - return nil, err
174 - }
175 -
176 - o, err := resolve.Resolve(ctx, n.Namesys, n.Resolver, p)
170 + o, err := n.ResolveNode(ctx, path.New(sp))
171 if err != nil {
172 return nil, err
173 }
go.mod
-1
@@ -110,7 +110,6 @@ require (
110 go.uber.org/multierr v1.1.0 // indirect
111 go4.org v0.0.0-20190313082347-94abd6928b1d // indirect
112 golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb
113 - google.golang.org/appengine v1.4.0 // indirect
113 gopkg.in/cheggaaa/pb.v1 v1.0.28
114 gotest.tools/gotestsum v0.3.4
115 )