Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
31115f51
Commit
31115f51
authored
Oct 31, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow `ipfs cat` on ipns path
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
36de29ac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
core/commands/cat.go
core/commands/cat.go
+7
-0
core/coreunix/cat.go
core/coreunix/cat.go
+1
-2
test/sharness/t0100-name.sh
test/sharness/t0100-name.sh
+6
-0
No files found.
core/commands/cat.go
View file @
31115f51
...
@@ -31,6 +31,13 @@ it contains.
...
@@ -31,6 +31,13 @@ it contains.
return
return
}
}
if
!
node
.
OnlineMode
()
{
if
err
:=
node
.
SetupOfflineRouting
();
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
}
readers
,
length
,
err
:=
cat
(
req
.
Context
(),
node
,
req
.
Arguments
())
readers
,
length
,
err
:=
cat
(
req
.
Context
(),
node
,
req
.
Arguments
())
if
err
!=
nil
{
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
...
...
core/coreunix/cat.go
View file @
31115f51
...
@@ -8,8 +8,7 @@ import (
...
@@ -8,8 +8,7 @@ import (
)
)
func
Cat
(
ctx
context
.
Context
,
n
*
core
.
IpfsNode
,
pstr
string
)
(
*
uio
.
DagReader
,
error
)
{
func
Cat
(
ctx
context
.
Context
,
n
*
core
.
IpfsNode
,
pstr
string
)
(
*
uio
.
DagReader
,
error
)
{
p
:=
path
.
FromString
(
pstr
)
dagNode
,
err
:=
core
.
Resolve
(
ctx
,
n
,
path
.
Path
(
pstr
))
dagNode
,
err
:=
n
.
Resolver
.
ResolvePath
(
ctx
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
test/sharness/t0100-name.sh
View file @
31115f51
...
@@ -54,6 +54,12 @@ test_expect_success "resolve output looks good" '
...
@@ -54,6 +54,12 @@ test_expect_success "resolve output looks good" '
test_cmp expected4 output
test_cmp expected4 output
'
'
test_expect_success
"ipfs cat on published content succeeds"
'
ipfs cat "/ipfs/$HASH_WELCOME_DOCS/help" >expected &&
ipfs cat "/ipns/$PEERID" >actual &&
test_cmp expected actual
'
# publish with an explicit node ID
# publish with an explicit node ID
test_expect_failure
"'ipfs name publish <local-id> <hash>' succeeds"
'
test_expect_failure
"'ipfs name publish <local-id> <hash>' succeeds"
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment