Skip to content

Commit

Permalink
Use apicid.Hash for ipfs file ls.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
  • Loading branch information
kevina committed Sep 25, 2018
1 parent f5c2c22 commit 86a7017
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/commands/unixfs/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (

cmdkit "gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"

cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
apicid "gx/ipfs/QmNWQygwYxgz3QzXG2ytTkrHkZ4HnnSh94ASox3JjktFcR/go-cidutil/apicid"

cmds "github.com/ipfs/go-ipfs/commands"
core "github.com/ipfs/go-ipfs/core"
e "github.com/ipfs/go-ipfs/core/commands/e"
Expand All @@ -27,7 +30,7 @@ type LsLink struct {
}

type LsObject struct {
Hash string
Hash apicid.Hash
Size uint64
Type string
Links []LsLink
Expand Down Expand Up @@ -129,7 +132,7 @@ possible, please use 'ipfs ls' instead.
t := unixFSNode.GetType()

output.Objects[hash] = &LsObject{
Hash: c.String(),
Hash: apicid.FromCid(c),
Type: t.String(),
Size: unixFSNode.GetFilesize(),
}
Expand Down Expand Up @@ -187,6 +190,11 @@ possible, please use 'ipfs ls' instead.
},
Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) (io.Reader, error) {
_, err := cmdenv.NewCidBaseHandlerLegacy(res.Request()).UseGlobal().Proc()
if err != nil {
return nil, err
}

v, err := unwrapOutput(res.Output())
if err != nil {
return nil, err
Expand Down

0 comments on commit 86a7017

Please sign in to comment.