Add symlink support to BuildDagFromFile
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
rht committed
Sep 3, 2015 at 08:44 UTC
0c95ed6b03e693a19c5047c65420ed6606485c36
1 file changed
+3
-2
importer/importer.go
+3
-2
@@ -6,6 +6,7 @@ import (
6
"fmt"
7
"os"
8
9
+ "github.com/ipfs/go-ipfs/commands/files"
10
bal "github.com/ipfs/go-ipfs/importer/balanced"
11
"github.com/ipfs/go-ipfs/importer/chunk"
12
h "github.com/ipfs/go-ipfs/importer/helpers"
@@ -20,7 +21,7 @@ var log = u.Logger("importer")
21
// Builds a DAG from the given file, writing created blocks to disk as they are
22
// created
23
func BuildDagFromFile(fpath string, ds dag.DAGService, mp pin.ManualPinner) (*dag.Node, error) {
23
- stat, err := os.Stat(fpath)
24
+ stat, err := os.Lstat(fpath)
25
if err != nil {
26
return nil, err
27
}
@@ -29,7 +30,7 @@ func BuildDagFromFile(fpath string, ds dag.DAGService, mp pin.ManualPinner) (*da
30
return nil, fmt.Errorf("`%s` is a directory", fpath)
31
}
32
32
- f, err := os.Open(fpath)
33
+ f, err := files.NewSerialFile(fpath, fpath, stat)
34
if err != nil {
35
return nil, err
36
}