diff --git a/core/commands/add.go b/core/commands/add.go index 6a7551795..91b55b36a 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -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), diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index 61050cc73..ce0ecf8fe 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -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 { diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 6d7ea6e33..e0235fb01 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -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) }