mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 12:57:44 +08:00
core/commands2: Use path.Split for path parsing in 'add'
This commit is contained in:
parent
380337b76b
commit
bfdf7951b3
@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"path"
|
||||
|
||||
cmds "github.com/jbenet/go-ipfs/commands"
|
||||
core "github.com/jbenet/go-ipfs/core"
|
||||
@ -149,9 +149,7 @@ func addDir(n *core.IpfsNode, dir cmds.File, added *AddOutput) (*dag.Node, error
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name := file.FileName()
|
||||
slashIndex := strings.LastIndex(name, "/")
|
||||
name = name[slashIndex+1:]
|
||||
_, name := path.Split(file.FileName())
|
||||
|
||||
err = tree.AddNodeLink(name, node)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user