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

Commit 348a144

Browse files
author
Alan Shaw
authored
fix: also retry with misnemed format "dag-cbor" as "cbor" (#888)
Prevents error unrecognized format: 'dag-cbor' License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
1 parent 5841842 commit 348a144

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/block/put.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ module.exports = (send) => {
5555

5656
sendOneFile(block.data, { qs }, (err, result) => {
5757
if (err) {
58-
// Retry with "protobuf" format for go-ipfs
58+
// Retry with "protobuf"/"cbor" format for go-ipfs
5959
// TODO: remove when https://github.com/ipfs/go-cid/issues/75 resolved
60-
if (qs.format === 'dag-pb') {
61-
qs.format = 'protobuf'
60+
if (qs.format === 'dag-pb' || qs.format === 'dag-cbor') {
61+
qs.format = qs.format === 'dag-pb' ? 'protobuf' : 'cbor'
6262
return sendOneFile(block.data, { qs }, (err, result) => {
6363
if (err) return callback(err)
6464
callback(null, new Block(block.data, new CID(result.Key)))

0 commit comments

Comments
 (0)