Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ipns address resolution in fuse unix mount #5384

Merged
merged 3 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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