Merge pull request #7331 from ipfs/fix/fuse-mount

fix: correctly trim resolved IPNS addresses
This commit is contained in:
Steven Allen 2020-05-19 18:52:10 -07:00 committed by GitHub
commit 167c834976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -188,7 +188,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
return nil, errors.New("invalid path from ipns record")
}
return &Link{s.IpfsRoot + "/" + strings.TrimPrefix("/ipfs/", resolved.String())}, nil
return &Link{s.IpfsRoot + "/" + strings.TrimPrefix(resolved.String(), "/ipfs/")}, nil
}
func (r *Root) Close() error {

View File

@ -15,6 +15,9 @@ if ! test_have_prereq FUSE; then
test_done
fi
export IPFS_NS_MAP="welcome.example.com:/ipfs/$HASH_WELCOME_DOCS"
# start iptb + wait for peering
NUM_NODES=5
test_expect_success 'init iptb' '
@ -22,7 +25,6 @@ test_expect_success 'init iptb' '
'
startup_cluster $NUM_NODES
# test mount failure before mounting properly.
test_expect_success "'ipfs mount' fails when there is no mount dir" '
tmp_ipfs_mount() { ipfsi 0 mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
@ -53,6 +55,12 @@ test_expect_success FUSE "'ipfs mount' output looks good" '
test_cmp expected actual
'
test_expect_success FUSE "can resolve ipns names" '
echo -n "ipfs" > expected &&
cat ipns/welcome.example.com/ping > actual &&
test_cmp expected actual
'
test_expect_success "mount directories cannot be removed while active" '
test_must_fail rmdir ipfs ipns 2>/dev/null
'