Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dag/get: accept paths and not just cids #3517

Merged
merged 2 commits into from
Dec 20, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

cmds "github.com/ipfs/go-ipfs/commands"
path "github.com/ipfs/go-ipfs/path"

node "gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node"
ipldcbor "gx/ipfs/QmbuuwTd9x4NReZ7sxtiKk7wFcfDUo54MfWBdtF5MRCPGR/go-ipld-cbor"
Expand Down Expand Up @@ -105,7 +106,7 @@ var DagGetCmd = &cmds.Command{
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("cid", true, false, "The cid of the object to get").EnableStdin(),
cmds.StringArg("ref", true, false, "The object to get").EnableStdin(),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand All @@ -114,13 +115,13 @@ var DagGetCmd = &cmds.Command{
return
}

c, err := cid.Decode(req.Arguments()[0])
p, err := path.ParsePath(req.Arguments()[0])
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}

obj, err := n.DAG.Get(req.Context(), c)
obj, err := n.Resolver.ResolvePath(req.Context(), p)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
Expand Down