From 6d687de430ff6818f85a03c7c448031cf3dba3fc Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 7 Nov 2018 11:07:12 +0000 Subject: [PATCH] fix: also retry with misnemed format "dag-cbor" as "cbor" Prevents error unrecognized format: 'dag-cbor' License: MIT Signed-off-by: Alan Shaw --- src/block/put.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/block/put.js b/src/block/put.js index 5c9eba414..03f6824db 100644 --- a/src/block/put.js +++ b/src/block/put.js @@ -55,10 +55,10 @@ module.exports = (send) => { sendOneFile(block.data, { qs }, (err, result) => { if (err) { - // Retry with "protobuf" format for go-ipfs + // Retry with "protobuf"/"cbor" format for go-ipfs // TODO: remove when https://github.com/ipfs/go-cid/issues/75 resolved - if (qs.format === 'dag-pb') { - qs.format = 'protobuf' + if (qs.format === 'dag-pb' || qs.format === 'dag-cbor') { + qs.format = qs.format === 'dag-pb' ? 'protobuf' : 'cbor' return sendOneFile(block.data, { qs }, (err, result) => { if (err) return callback(err) callback(null, new Block(block.data, new CID(result.Key)))