core/commands: get: Place files at root of TAR when using a multi-element ipfs path
Matt Bell committed
Jan 24, 2015 at 13:46 UTC
41d5c822d70f5748e70ff78fabfd3f2d50d02273
2 files changed
+4
-2
core/commands/get.go
+2
-1
@@ -6,6 +6,7 @@ import (
6
"fmt"
7
"io"
8
"os"
9
+ p "path"
10
"strings"
11
12
cmds "github.com/jbenet/go-ipfs/commands"
@@ -76,7 +77,7 @@ may also specify the level of compression by specifying '-l=<1-9>'.
77
78
outPath, _, _ := req.Option("output").String()
79
if len(outPath) == 0 {
79
- outPath = req.Arguments()[0]
80
+ _, outPath = p.Split(req.Arguments()[0])
81
}
82
83
cmplvl, err := getCompressOptions(req)
unixfs/tar/reader.go
+2
-1
@@ -51,7 +51,8 @@ func NewReader(path string, dag mdag.DAGService, resolver *path.Resolver, compre
51
52
// writeToBuf will write the data to the buffer, and will signal when there
53
// is new data to read
54
- go reader.writeToBuf(dagnode, path, 0)
54
+ _, filename := p.Split(path)
55
+ go reader.writeToBuf(dagnode, filename, 0)
56
57
return reader, nil
58
}