@cryptotaxi247 / kubo / commits / bfdf7951b

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

Matt Bell committed Nov 17, 2014 at 02:44 UTC bfdf7951b39f238e09d49f6d86aecf36d27bf395
1 file changed +2 -4
core/commands2/add.go
+2 -4
@@ -5,7 +5,7 @@ import (
5 "errors"
6 "fmt"
7 "io"
8 - "strings"
8 + "path"
9
10 cmds "github.com/jbenet/go-ipfs/commands"
11 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 return nil, err
150 }
151
152 - name := file.FileName()
153 - slashIndex := strings.LastIndex(name, "/")
154 - name = name[slashIndex+1:]
152 + _, name := path.Split(file.FileName())
153
154 err = tree.AddNodeLink(name, node)
155 if err != nil {