From bde04e384301ac0aeb4d189899bb1a687f541430 Mon Sep 17 00:00:00 2001 From: kvm2116 Date: Wed, 1 Aug 2018 11:30:08 -0500 Subject: [PATCH 1/3] Fixed ipns address resolution in fuse unix mount License: MIT Signed-off-by: Kunal Mahajan --- fuse/ipns/ipns_unix.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 37d6db253ea..4ae990439e3 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) + ipns_name := "/ipns/" + name + resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipns_name) if err != nil { log.Warningf("ipns: namesys resolve error: %s", err) return nil, fuse.ENOENT From d586c34b8aa74f42b31ff6bbb686c74c49fd00f6 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 15 Aug 2018 11:49:54 -0700 Subject: [PATCH 2/3] fix go style License: MIT Signed-off-by: Steven Allen --- fuse/ipns/ipns_unix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 4ae990439e3..c39dd8497ad 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -196,8 +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 - ipns_name := "/ipns/" + name - resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipns_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 From c22cfbbf755a5138583cd208abb43a1481ae7e06 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 15 Aug 2018 16:33:27 -0700 Subject: [PATCH 3/3] add test case for /ipns/QmId... License: MIT Signed-off-by: Steven Allen --- fuse/ipns/ipns_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fuse/ipns/ipns_test.go b/fuse/ipns/ipns_test.go index 40a74639b39..4b47ca17d48 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