mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 21:07:45 +08:00
Merge pull request #7331 from ipfs/fix/fuse-mount
fix: correctly trim resolved IPNS addresses
This commit is contained in:
commit
167c834976
@ -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 {
|
||||
|
||||
@ -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
|
||||
'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user