mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-17 15:06:47 +08:00
unixfs add: remove StdinName
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
@ -189,7 +189,7 @@ You can now check what blocks have been created by:
|
||||
|
||||
var toadd files.Node = req.Files
|
||||
name := ""
|
||||
if !wrap {
|
||||
if !wrap || pathName != "" {
|
||||
it := req.Files.Entries()
|
||||
if !it.Next() {
|
||||
err := it.Err()
|
||||
@ -204,7 +204,13 @@ You can now check what blocks have been created by:
|
||||
}
|
||||
_, dir := toadd.(files.Directory)
|
||||
if !dir && pathName != "" {
|
||||
name = pathName
|
||||
if wrap {
|
||||
toadd = files.NewSliceDirectory([]files.DirEntry{
|
||||
files.FileEntry(pathName, toadd),
|
||||
})
|
||||
} else {
|
||||
name = pathName
|
||||
}
|
||||
}
|
||||
|
||||
opts := []options.UnixfsAddOption{
|
||||
@ -220,8 +226,6 @@ You can now check what blocks have been created by:
|
||||
options.Unixfs.FsCache(fscache),
|
||||
options.Unixfs.Nocopy(nocopy),
|
||||
|
||||
options.Unixfs.StdinName(pathName),
|
||||
|
||||
options.Unixfs.Progress(progress),
|
||||
options.Unixfs.Silent(silent),
|
||||
options.Unixfs.Events(events),
|
||||
|
@ -92,7 +92,6 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
fileAdder.Silent = settings.Silent
|
||||
fileAdder.RawLeaves = settings.RawLeaves
|
||||
fileAdder.NoCopy = settings.NoCopy
|
||||
fileAdder.Name = settings.StdinName
|
||||
fileAdder.CidBuilder = prefix
|
||||
|
||||
switch settings.Layout {
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
gopath "path"
|
||||
"strconv"
|
||||
|
||||
@ -71,7 +70,6 @@ type Adder struct {
|
||||
RawLeaves bool
|
||||
Silent bool
|
||||
Wrap bool
|
||||
Name string
|
||||
NoCopy bool
|
||||
Chunker string
|
||||
root ipld.Node
|
||||
@ -418,13 +416,6 @@ func (adder *Adder) addFile(path string, file files.File) error {
|
||||
return err
|
||||
}
|
||||
|
||||
addFileInfo, ok := file.(files.FileInfo)
|
||||
if ok {
|
||||
if addFileInfo.AbsPath() == os.Stdin.Name() && adder.Name != "" {
|
||||
path = adder.Name
|
||||
adder.Name = ""
|
||||
}
|
||||
}
|
||||
// patch it into the root
|
||||
return adder.addNode(dagnode, path)
|
||||
}
|
||||
|
Reference in New Issue
Block a user