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

fix: block.put options #844

Merged
merged 4 commits into from
Sep 20, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key change for me that would have allowed me to complete #815. Still learned a lot from trying to work that story. Time to find a new issue to dig into. :)

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