1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-20 02:21:48 +08:00

Merge pull request #5509 from ipfs/chores/add-sessions-to-ls-command-4908

Add sessions when fetching MerkleDAG in LS
This commit is contained in:
Steven Allen
2018-10-02 16:06:41 -07:00
committed by GitHub

View File

@ -107,9 +107,11 @@ The JSON output contains type information.
}
output := make([]LsObject, len(req.Arguments()))
ng := merkledag.NewSession(req.Context(), nd.DAG)
ro := merkledag.NewReadOnlyDagService(ng)
for i, dagnode := range dagnodes {
dir, err := uio.NewDirectoryFromNode(nd.DAG, dagnode)
dir, err := uio.NewDirectoryFromNode(ro, dagnode)
if err != nil && err != uio.ErrNotADir {
res.SetError(fmt.Errorf("the data in %s (at %q) is not a UnixFS directory: %s", dagnode.Cid(), paths[i], err), cmdkit.ErrNormal)
return