Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: block.get supports multihash as buffers again
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Dec 9, 2016
1 parent 2b498b9 commit b3dbe45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
"glob": "^7.1.1",
"glob-escape": "0.0.2",
"ipfs-block": "^0.5.1",
"ipld-dag-pb": "^0.9.2",
"ipld-dag-pb": "^0.9.3",
"is-ipfs": "^0.2.1",
"isstream": "^0.1.2",
"lru-cache": "^4.0.2",
"multiaddr": "^2.1.1",
"multipart-stream": "^2.0.1",
"ndjson": "^1.4.3",
"ndjson": "^1.5.0",
"once": "^1.4.0",
"peer-id": "^0.8.0",
"peer-info": "^0.8.1",
Expand All @@ -59,15 +59,15 @@
"devDependencies": {
"aegir": "^9.1.2",
"chai": "^3.5.0",
"eslint-plugin-react": "^6.7.1",
"eslint-plugin-react": "^6.8.0",
"gulp": "^3.9.1",
"hapi": "^16.0.1",
"interface-ipfs-core": "^0.22.0",
"ipfsd-ctl": "^0.17.0",
"pre-commit": "^1.1.3",
"socket.io": "^1.7.1",
"socket.io-client": "^1.7.1",
"stream-equal": "^0.1.11"
"stream-equal": "^0.1.12"
},
"pre-commit": [
"lint",
Expand Down Expand Up @@ -115,4 +115,4 @@
"url": "https://github.com/ipfs/js-ipfs-api/issues"
},
"homepage": "https://github.com/ipfs/js-ipfs-api"
}
}
7 changes: 5 additions & 2 deletions src/api/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ module.exports = (send) => {
return {
get: promisify((args, opts, callback) => {
// TODO this needs to be adjusted with the new go-ipfs http-api
if (args && CID.isCID(args)) {
if (CID.isCID(args)) {
args = multihash.toB58String(args.multihash)
}
if (typeof (opts) === 'function') {
if (Buffer.isBuffer(args)) {
args = multihash.toB58String(args)
}
if (typeof opts === 'function') {
callback = opts
opts = {}
}
Expand Down

0 comments on commit b3dbe45

Please sign in to comment.