diff --git a/src/block/put.js b/src/block/put.js index 91f648b87..5c9eba414 100644 --- a/src/block/put.js +++ b/src/block/put.js @@ -55,7 +55,17 @@ module.exports = (send) => { sendOneFile(block.data, { qs }, (err, result) => { if (err) { - return callback(err) // early + // Retry with "protobuf" format for go-ipfs + // TODO: remove when https://github.com/ipfs/go-cid/issues/75 resolved + if (qs.format === 'dag-pb') { + qs.format = 'protobuf' + return sendOneFile(block.data, { qs }, (err, result) => { + if (err) return callback(err) + callback(null, new Block(block.data, new CID(result.Key))) + }) + } + + return callback(err) } callback(null, new Block(block.data, new CID(result.Key)))