Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c0703ef

Browse files
authored
fix: correct raw leaves setting (#3401)
If raw-leaves is unset, default to true if cid version is > 0. This is in line with go-IPFS and is what the importer used to do internally.
1 parent 39cad4b commit c0703ef

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/ipfs-cli/src/commands/add.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ module.exports = {
7979
},
8080
'raw-leaves': {
8181
type: 'boolean',
82-
describe: 'Use raw blocks for leaf nodes. (experimental)',
83-
default: false
82+
describe: 'Use raw blocks for leaf nodes. (experimental)'
8483
},
8584
'cid-version': {
8685
type: 'integer',
@@ -241,6 +240,10 @@ module.exports = {
241240
}
242241
}
243242

243+
if (options.rawLeaves == null) {
244+
options.rawLeaves = cidVersion > 0
245+
}
246+
244247
const source = file
245248
? globSource(file, {
246249
recursive,

packages/ipfs-cli/test/add.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ describe('add', () => {
101101

102102
ipfs.addAll.withArgs(matchIterable(), {
103103
...defaultOptions,
104-
cidVersion: 1
104+
cidVersion: 1,
105+
rawLeaves: true
105106
}).returns([{
106107
cid,
107108
path: 'README.md'

0 commit comments

Comments
 (0)