diff --git a/package.json b/package.json index 45034674e5..fe8515957c 100644 --- a/package.json +++ b/package.json @@ -184,7 +184,7 @@ "form-data": "^3.0.0", "go-ipfs-dep": "^0.4.23", "hat": "0.0.3", - "interface-ipfs-core": "^0.131.7", + "interface-ipfs-core": "^0.132.0", "ipfs-interop": "github:ipfs/interop#refactor/async-await", "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#remove-option-normalisation", "ncp": "^2.0.0", diff --git a/src/core/components/block/put.js b/src/core/components/block/put.js index 526bc23e7f..2d4b292faf 100644 --- a/src/core/components/block/put.js +++ b/src/core/components/block/put.js @@ -3,6 +3,7 @@ const Block = require('ipfs-block') const multihashing = require('multihashing-async') const CID = require('cids') +const isIPFS = require('is-ipfs') module.exports = ({ blockService, gcLock, preload }) => { return async function put (block, options) { @@ -13,8 +14,8 @@ module.exports = ({ blockService, gcLock, preload }) => { } if (!Block.isBlock(block)) { - if (options.cid && CID.isCID(options.cid)) { - block = new Block(block, options.cid) + if (options.cid && isIPFS.cid(options.cid)) { + block = new Block(block, CID.isCID(options.cid) ? options.cid : new CID(options.cid)) } else { const mhtype = options.mhtype || 'sha2-256' const format = options.format || 'dag-pb'