Commit bfdf7951 authored by Matt Bell's avatar Matt Bell

core/commands2: Use path.Split for path parsing in 'add'

parent 380337b7
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"strings" "path"
cmds "github.com/jbenet/go-ipfs/commands" cmds "github.com/jbenet/go-ipfs/commands"
core "github.com/jbenet/go-ipfs/core" core "github.com/jbenet/go-ipfs/core"
...@@ -149,9 +149,7 @@ func addDir(n *core.IpfsNode, dir cmds.File, added *AddOutput) (*dag.Node, error ...@@ -149,9 +149,7 @@ func addDir(n *core.IpfsNode, dir cmds.File, added *AddOutput) (*dag.Node, error
return nil, err return nil, err
} }
name := file.FileName() _, name := path.Split(file.FileName())
slashIndex := strings.LastIndex(name, "/")
name = name[slashIndex+1:]
err = tree.AddNodeLink(name, node) err = tree.AddNodeLink(name, node)
if err != nil { if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment