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

Commit

Permalink
fix: workaround for ipfs/go-cid#75
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw committed Sep 20, 2018
1 parent 0044fa0 commit 2bc33d9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 2bc33d9

Please sign in to comment.