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
d5c8fa50
Unverified
Commit
d5c8fa50
authored
Oct 30, 2018
by
Steven Allen
Committed by
GitHub
Oct 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5705 from ipfs/fix/resolve-non-terminal
error on resolving non-terminal paths
parents
b6e1d387
126d996f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
core/commands/resolve.go
core/commands/resolve.go
+6
-2
test/sharness/t0160-resolve.sh
test/sharness/t0160-resolve.sh
+9
-0
No files found.
core/commands/resolve.go
View file @
d5c8fa50
...
...
@@ -135,9 +135,13 @@ Resolve the value of an IPFS DAG path:
return
err
}
c
:=
rp
.
Cid
()
if
rp
.
Remainder
()
!=
""
{
// TODO: js expects this error. Instead of fixing this
// error, we should fix #5703.
return
fmt
.
Errorf
(
"found non-link at given path"
)
}
return
cmds
.
EmitOnce
(
res
,
&
ncmd
.
ResolvedPath
{
Path
:
path
.
FromCid
(
c
)})
return
cmds
.
EmitOnce
(
res
,
&
ncmd
.
ResolvedPath
{
Path
:
path
.
Path
(
"/"
+
rp
.
Namespace
()
+
"/"
+
rp
.
Cid
()
.
String
()
)})
},
Encoders
:
cmds
.
EncoderMap
{
cmds
.
Text
:
cmds
.
MakeEncoder
(
func
(
req
*
cmds
.
Request
,
w
io
.
Writer
,
v
interface
{})
error
{
...
...
test/sharness/t0160-resolve.sh
View file @
d5c8fa50
...
...
@@ -14,6 +14,10 @@ test_expect_success "resolve: prepare files" '
c_hash=$(ipfs add -q -r a/b/c | tail -n1)
'
test_expect_success
"resolve: prepare dag"
'
dag_hash=$(ipfs dag put <<<"{\"a\": {\"b\": {\"c\": \"asdfasdfasdf\"}}}")
'
test_resolve_setup_name
()
{
ref
=
$1
...
...
@@ -92,6 +96,11 @@ test_resolve_cmd_fail() {
test_resolve
"/ipfs/
$a_hash
/b"
"/ipfs/
$b_hash
"
test_resolve
"/ipfs/
$a_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve
"/ipfs/
$b_hash
/c"
"/ipfs/
$c_hash
"
test_resolve
"/ipld/
$dag_hash
"
"/ipld/
$dag_hash
"
test_resolve_fail
"/ipld/
$dag_hash
/a/b/c"
"/ipld/
$dag_hash
/a/b/c"
test_resolve_fail
"/ipld/
$dag_hash
/a/b"
"/ipld/
$dag_hash
/a/b"
test_resolve_fail
"/ipld/
$dag_hash
/a"
"/ipld/
$dag_hash
/a"
test_resolve_setup_name_fail
"/ipfs/
$a_hash
"
test_resolve_fail
"/ipns/
$id_hash
"
"/ipfs/
$a_hash
"
...
...
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