@cryptotaxi247 / kubo / commits / 391d34562

fix: correctly trim resolved IPNS addresses

fixes https://github.com/ipfs/go-ipfs/issues/7246

Steven Allen committed May 19, 2020 at 17:38 UTC 391d345622e055c9b1b9bd272aabd4a2f61a9002
2 files changed +10 -2
fuse/ipns/ipns_unix.go
+1 -1
@@ -188,7 +188,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
188 return nil, errors.New("invalid path from ipns record")
189 }
190
191 - return &Link{s.IpfsRoot + "/" + strings.TrimPrefix("/ipfs/", resolved.String())}, nil
191 + return &Link{s.IpfsRoot + "/" + strings.TrimPrefix(resolved.String(), "/ipfs/")}, nil
192 }
193
194 func (r *Root) Close() error {
test/sharness/t0030-mount.sh
+9 -1
@@ -15,6 +15,9 @@ if ! test_have_prereq FUSE; then
15 test_done
16 fi
17
18 +
19 +export IPFS_NS_MAP="welcome.example.com:/ipfs/$HASH_WELCOME_DOCS"
20 +
21 # start iptb + wait for peering
22 NUM_NODES=5
23 test_expect_success 'init iptb' '
@@ -22,7 +25,6 @@ test_expect_success 'init iptb' '
25 '
26 startup_cluster $NUM_NODES
27
25 -
28 # test mount failure before mounting properly.
29 test_expect_success "'ipfs mount' fails when there is no mount dir" '
30 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" '
55 test_cmp expected actual
56 '
57
58 +test_expect_success FUSE "can resolve ipns names" '
59 + echo -n "ipfs" > expected &&
60 + cat ipns/welcome.example.com/ping > actual &&
61 + test_cmp expected actual
62 +'
63 +
64 test_expect_success "mount directories cannot be removed while active" '
65 test_must_fail rmdir ipfs ipns 2>/dev/null
66 '