diff --git a/fuse/ipns/ipns_test.go b/fuse/ipns/ipns_test.go index 40a74639b..4b47ca17d 100644 --- a/fuse/ipns/ipns_test.go +++ b/fuse/ipns/ipns_test.go @@ -168,7 +168,7 @@ func TestIpnsBasicIO(t *testing.T) { if testing.Short() { t.SkipNow() } - _, mnt := setupIpnsTest(t, nil) + nd, mnt := setupIpnsTest(t, nil) defer closeMount(mnt) fname := mnt.Dir + "/local/testfile" @@ -182,6 +182,16 @@ func TestIpnsBasicIO(t *testing.T) { if !bytes.Equal(rbuf, data) { t.Fatal("Incorrect Read!") } + + fname2 := mnt.Dir + "/" + nd.Identity.Pretty() + "/testfile" + rbuf, err = ioutil.ReadFile(fname2) + if err != nil { + t.Fatal(err) + } + + if !bytes.Equal(rbuf, data) { + t.Fatal("Incorrect Read!") + } } // Test to make sure file changes persist over mounts of ipns diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 37d6db253..c39dd8497 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -196,7 +196,8 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) { } // other links go through ipns resolution and are symlinked into the ipfs mountpoint - resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), name) + ipnsName := "/ipns/" + name + resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipnsName) if err != nil { log.Warningf("ipns: namesys resolve error: %s", err) return nil, fuse.ENOENT