Skip to content

Commit

Permalink
fix: also retry with misnemed format "dag-cbor" as "cbor" (ipfs#888)
Browse files Browse the repository at this point in the history
Prevents error unrecognized format: 'dag-cbor'

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
Alan Shaw authored Nov 9, 2018
1 parent 5841842 commit 348a144
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 348a144

Please sign in to comment.