resolve: use unixfs ResolveOnce
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Sep 18, 2018 at 01:08 UTC
ec96a21db3b336f2393ce2b6adfe3138076308d5
2 files changed
+14
-1
core/commands/resolve.go
+8
-1
@@ -14,7 +14,9 @@ import (
14
nsopts "github.com/ipfs/go-ipfs/namesys/opts"
15
path "gx/ipfs/QmX7uSbkNz76yNwBhuwYwRbhihLnJqM73VTCjS3UMJud9A/go-path"
16
17
+ uio "gx/ipfs/QmPL8bYtbACcSFFiSr4s2du7Na382NxRADR8hC7D9FkEA2/go-unixfs/io"
18
"gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
19
+ resolver "gx/ipfs/QmX7uSbkNz76yNwBhuwYwRbhihLnJqM73VTCjS3UMJud9A/go-path/resolver"
20
)
21
22
var ResolveCmd = &cmds.Command{
@@ -121,7 +123,12 @@ Resolve the value of an IPFS DAG path:
123
return
124
}
125
124
- node, err := core.Resolve(req.Context(), n.Namesys, n.Resolver, p)
126
+ r := &resolver.Resolver{
127
+ DAG: n.DAG,
128
+ ResolveOnce: uio.ResolveUnixfsOnce,
129
+ }
130
+
131
+ node, err := core.Resolve(req.Context(), n.Namesys, r, p)
132
if err != nil {
133
res.SetError(err, cmdkit.ErrNormal)
134
return
test/sharness/t0260-sharding.sh
+6
@@ -84,6 +84,12 @@ test_expect_success "gateway can resolve sharded dirs" '
84
test_cmp expected actual
85
'
86
87
+test_expect_success "'ipfs resolve' can resolve sharded dirs" '
88
+ echo /ipfs/QmZ3RfWk1u5LEGYLHA633B5TNJy3Du27K6Fny9wcxpowGS > expected &&
89
+ ipfs resolve "/ipfs/$SHARDED/file100" > actual &&
90
+ test_cmp expected actual
91
+'
92
+
93
test_kill_ipfs_daemon
94
95
test_add_large_dir_v1() {