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 27, 2018
1 parent ce0877e commit f25f4eb
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/QmdPF1WZQHFNfLdwhaShiR3e4KvFviAM58TrxVxPMhukic/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 @@ -26,7 +29,7 @@ type LsLink struct {
}

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

output.Objects[hash] = &LsObject{
Hash: c.String(),
Hash: apicid.FromCid(c),
Type: t.String(),
Size: unixFSNode.FileSize(),
}
Expand Down Expand Up @@ -186,6 +189,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 f25f4eb

Please sign in to comment.