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

Commit

Permalink
fix(dag): js-ipld format resolver take the raw block
Browse files Browse the repository at this point in the history
The js-ipld formats API changed, they now take a raw data block
rather than an IPFS block.
  • Loading branch information
vmx authored and daviddias committed Apr 5, 2018
1 parent d2b203b commit 2683c7e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/dag/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ module.exports = (send) => {
}, cb)
},
(resolved, cb) => {
block(send).get(new CID(resolved['Cid']['/']), (err, blk) => cb(err, blk, resolved['RemPath']))
block(send).get(new CID(resolved['Cid']['/']), (err, ipfsBlock) => {
cb(err, ipfsBlock, resolved['RemPath'])
})
},
(blk, path, cb) => {
if (blk.cid.codec === 'dag-cbor') {
dagCBOR.resolver.resolve(blk, path, cb)
(ipfsBlock, path, cb) => {
if (ipfsBlock.cid.codec === 'dag-cbor') {
dagCBOR.resolver.resolve(ipfsBlock.data, path, cb)
}
if (blk.cid.codec === 'dag-pb') {
dagPB.resolver.resolve(blk, path, cb)
if (ipfsBlock.cid.codec === 'dag-pb') {
dagPB.resolver.resolve(ipfsBlock.data, path, cb)
}
}
], callback)
Expand Down

0 comments on commit 2683c7e

Please sign in to comment.