Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
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 @@ -79,7 +79,7 @@
"eslint-plugin-react": "^7.9.1",
"go-ipfs-dep": "~0.4.15",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.68.1",
"interface-ipfs-core": "~0.69.0",
"ipfsd-ctl": "~0.37.3",
"pull-stream": "^3.6.8",
"socket.io": "^2.1.1",
Expand Down
7 changes: 7 additions & 0 deletions src/block/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,18 @@ module.exports = (send) => {
const transform = (res, callback) => {
if (Buffer.isBuffer(res)) {
callback(null, new Block(res, cid))
// For empty blocks, concat-stream can't infer the encoding so we are
// passed back an empty array
} else if (Array.isArray(res) && res.length === 0) {
callback(null, new Block(Buffer.alloc(0), cid))
} else {
streamToValue(res, (err, data) => {
if (err) {
return callback(err)
}
// For empty blocks, concat-stream can't infer the encoding so we are
// passed back an empty array
if (!data.length) data = Buffer.alloc(0)
callback(null, new Block(data, cid))
})
}
Expand Down