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
60ac5913
Commit
60ac5913
authored
9 years ago
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix offline full path resolution bug
parent
5853eac3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
core/pathresolver.go
core/pathresolver.go
+3
-2
test/sharness/t0041-add-cat-offline.sh
test/sharness/t0041-add-cat-offline.sh
+34
-0
No files found.
core/pathresolver.go
View file @
60ac5913
...
...
@@ -20,8 +20,9 @@ var ErrNoNamesys = errors.New(
// entries and returning the final merkledage node. Effectively
// enables /ipns/, /dns/, etc. in commands.
func
Resolve
(
ctx
context
.
Context
,
n
*
IpfsNode
,
p
path
.
Path
)
(
*
merkledag
.
Node
,
error
)
{
if
strings
.
HasPrefix
(
p
.
String
(),
"/"
)
{
// namespaced path (/ipfs/..., /ipns/..., etc.)
if
strings
.
HasPrefix
(
p
.
String
(),
"/ipns/"
)
{
// resolve ipns paths
// TODO(cryptix): we sould be able to query the local cache for the path
if
n
.
Namesys
==
nil
{
return
nil
,
ErrNoNamesys
...
...
This diff is collapsed.
Click to expand it.
test/sharness/t0041-add-cat-offline.sh
0 → 100755
View file @
60ac5913
#!/bin/sh
#
# Copyright (c) 2014 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test add and cat commands"
.
lib/test-lib.sh
test_init_ipfs
test_expect_success
"ipfs add file succeeds"
'
echo "some content" > afile &&
HASH=$(ipfs add -q afile)
'
test_expect_success
"ipfs cat file suceeds"
'
ipfs cat $HASH > out_1
'
test_expect_success
"output looks good"
'
test_cmp afile out_1
'
test_expect_success
"ipfs cat /ipfs/file succeeds"
'
ipfs cat /ipfs/$HASH > out_2
'
test_expect_success
"output looks good"
'
test_cmp afile out_2
'
test_done
This diff is collapsed.
Click to expand it.
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