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

Commit

Permalink
fix: accept objects in file.add (#1257)
Browse files Browse the repository at this point in the history
hotfix: this was a regression on last release
  • Loading branch information
dryajov authored and daviddias committed Mar 9, 2018
1 parent 5b40b41 commit d32dad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit d32dad9

Please sign in to comment.