Wrap single files in Unixfs.Add
This commit was moved from ipfs/go-ipfs-http-client@16f77b24a1b150e7ec624d5675ded478ac6cb853
Łukasz Magiera committed
Jan 8, 2019 at 02:09 UTC
7861315f49398e20e7e1189671e42d0a16adbef0
1 file changed
+2
-1
client/httpapi/unixfs.go
+2
-1
@@ -66,7 +66,8 @@ func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.Unix
66
case files.Directory:
67
req.Body(files.NewMultiFileReader(c, false))
68
case files.File:
69
- req.Body(c)
69
+ d := files.NewMapDirectory(map[string]files.Node{"": c}) // unwrapped on the other side
70
+ req.Body(files.NewMultiFileReader(d, false))
71
}
72
73
var out addEvent