Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ba80e40

Browse files
author
Alan Shaw
authored
fix: file support when added as object (#2105)
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 7815c2f commit ba80e40

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"execa": "^1.0.0",
7373
"form-data": "^2.3.3",
7474
"hat": "0.0.3",
75-
"interface-ipfs-core": "~0.103.0",
75+
"interface-ipfs-core": "~0.104.0",
7676
"ipfsd-ctl": "~0.42.0",
7777
"libp2p-websocket-star": "~0.10.2",
7878
"ncp": "^2.0.0",

src/core/components/files-regular/add-pull-stream.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,16 @@ function normalizeContent (content, opts) {
7474
}
7575

7676
if (data && data.content && typeof data.content !== 'function') {
77+
if (supportsFileReader && kindOf(data.content) === 'file') {
78+
data = { path: data.path, content: toPull.source(streamFromFileReader(data.content)) }
79+
}
80+
7781
if (Buffer.isBuffer(data.content)) {
78-
data.content = pullValues([data.content])
82+
data = { path: data.path, content: pullValues([data.content]) }
7983
}
8084

8185
if (isStream.readable(data.content)) {
82-
data.content = toPull.source(data.content)
86+
data = { path: data.path, content: toPull.source(data.content) }
8387
}
8488
}
8589

0 commit comments

Comments
 (0)