diff --git a/package.json b/package.json index aa058a8de..c335002b1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/block/get.js b/src/block/get.js index c30381893..327b9e7ff 100644 --- a/src/block/get.js +++ b/src/block/get.js @@ -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)) }) }