Skip to content

Commit

Permalink
Merge pull request #5167 from djdv/fix-addr
Browse files Browse the repository at this point in the history
add: use file name instead of path name
  • Loading branch information
whyrusleeping committed Jun 28, 2018
2 parents b183da3 + 6da92a1 commit 336520d
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/coreunix/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
gopath "path"
"path/filepath"
"strconv"

core "github.com/ipfs/go-ipfs/core"
Expand Down Expand Up @@ -316,7 +317,7 @@ func AddR(n *core.IpfsNode, root string) (key string, err error) {
return "", err
}

f, err := files.NewSerialFile(root, root, false, stat)
f, err := files.NewSerialFile(filepath.Base(root), root, false, stat)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion core/coreunix/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestAddRecursive(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if k, err := AddR(node, "test_data"); err != nil {
if k, err := AddR(node, "test/data"); err != nil {
t.Fatal(err)
} else if k != "QmWCCga8AbTyfAQ7pTnGT6JgmRMAB3Qp8ZmTEFi5q5o8jC" {
t.Fatal("keys do not match: ", k)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 336520d

Please sign in to comment.