Skip to content

Commit

Permalink
Merge pull request #5384 from ipfs/fix/ipns-mount
Browse files Browse the repository at this point in the history
Fixed ipns address resolution in fuse unix mount
  • Loading branch information
Stebalien authored Aug 16, 2018
2 parents f6ba685 + c22cfbb commit afda4ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion fuse/ipns/ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion fuse/ipns/ipns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afda4ca

Please sign in to comment.