diff --git a/core/commands/ls.go b/core/commands/ls.go index 566e0ad0135b..a41baf642b0d 100644 --- a/core/commands/ls.go +++ b/core/commands/ls.go @@ -108,9 +108,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