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

fix: accept objects in file.add #1257

Merged
merged 3 commits into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"hapi-set-header": "^1.0.2",
"hoek": "^5.0.3",
"human-to-milliseconds": "^1.0.0",
"ipfs-api": "^18.1.1",
"ipfs-api": "^18.1.2",
"ipfs-bitswap": "~0.19.0",
"ipfs-block": "~0.6.1",
"ipfs-block-service": "~0.13.0",
Expand Down
5 changes: 3 additions & 2 deletions src/core/components/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ module.exports = function files (self) {
const ok = Buffer.isBuffer(data) ||
isStream.readable(data) ||
Array.isArray(data) ||
OtherBuffer.isBuffer(data)
OtherBuffer.isBuffer(data) ||
typeof data === 'object'

if (!ok) {
return callback(new Error('Invalid arguments, data must be an object, Buffer or readable stream'))
return callback(new Error('first arg must be a buffer, readable stream, an object or array of objects'))
}

pull(
Expand Down