core/commands: get: Clean output path
Matt Bell committed
Jan 26, 2015 at 17:07 UTC
d666155a0a61f9614247ccb79b8095db7a17adba
1 file changed
+5
-4
core/commands/get.go
+5
-4
@@ -6,7 +6,7 @@ import (
6
"fmt"
7
"io"
8
"os"
9
- p "path"
9
+ "path"
10
"strings"
11
12
cmds "github.com/jbenet/go-ipfs/commands"
@@ -77,7 +77,8 @@ may also specify the level of compression by specifying '-l=<1-9>'.
77
78
outPath, _, _ := req.Option("output").String()
79
if len(outPath) == 0 {
80
- _, outPath = p.Split(req.Arguments()[0])
80
+ _, outPath = path.Split(req.Arguments()[0])
81
+ outPath = path.Clean(outPath)
82
}
83
84
cmplvl, err := getCompressOptions(req)
@@ -163,6 +164,6 @@ func getCompressOptions(req cmds.Request) (int, error) {
164
return gzip.NoCompression, nil
165
}
166
166
-func get(node *core.IpfsNode, path string, compression int) (io.Reader, error) {
167
- return utar.NewReader(path, node.DAG, node.Resolver, compression)
167
+func get(node *core.IpfsNode, p string, compression int) (io.Reader, error) {
168
+ return utar.NewReader(p, node.DAG, node.Resolver, compression)
169
}