From 41d5c822d70f5748e70ff78fabfd3f2d50d02273 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Sat, 24 Jan 2015 13:46:08 -0800 Subject: [PATCH] core/commands: get: Place files at root of TAR when using a multi-element ipfs path --- core/commands/get.go | 3 ++- unixfs/tar/reader.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/commands/get.go b/core/commands/get.go index 08e64975b..9aca5750f 100644 --- a/core/commands/get.go +++ b/core/commands/get.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + p "path" "strings" cmds "github.com/jbenet/go-ipfs/commands" @@ -76,7 +77,7 @@ may also specify the level of compression by specifying '-l=<1-9>'. outPath, _, _ := req.Option("output").String() if len(outPath) == 0 { - outPath = req.Arguments()[0] + _, outPath = p.Split(req.Arguments()[0]) } cmplvl, err := getCompressOptions(req) diff --git a/unixfs/tar/reader.go b/unixfs/tar/reader.go index 081d816a2..6ec333928 100644 --- a/unixfs/tar/reader.go +++ b/unixfs/tar/reader.go @@ -51,7 +51,8 @@ func NewReader(path string, dag mdag.DAGService, resolver *path.Resolver, compre // writeToBuf will write the data to the buffer, and will signal when there // is new data to read - go reader.writeToBuf(dagnode, path, 0) + _, filename := p.Split(path) + go reader.writeToBuf(dagnode, filename, 0) return reader, nil }