@cryptotaxi247 / kubo / commits / 47f3c4048

Add sessions to LS command

Uses sessions when fetching MerkleDAG License: MIT Signed-off-by: hannahhoward <hannah@hannahhoward.net>

hannahhoward committed Sep 21, 2018 at 16:02 UTC 47f3c4048d979b5de0ccc81856421d1a55c5a34d
1 file changed +3 -1
core/commands/ls.go
+3 -1
@@ -108,9 +108,11 @@ The JSON output contains type information.
108 }
109
110 output := make([]LsObject, len(req.Arguments()))
111 + ng := merkledag.NewSession(req.Context(), nd.DAG)
112 + ro := merkledag.NewReadOnlyDagService(ng)
113
114 for i, dagnode := range dagnodes {
113 - dir, err := uio.NewDirectoryFromNode(nd.DAG, dagnode)
115 + dir, err := uio.NewDirectoryFromNode(ro, dagnode)
116 if err != nil && err != uio.ErrNotADir {
117 res.SetError(fmt.Errorf("the data in %s (at %q) is not a UnixFS directory: %s", dagnode.Cid(), paths[i], err), cmdkit.ErrNormal)
118 return