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

fix: correct raw leaves setting #3401

Merged
merged 1 commit into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions packages/ipfs-cli/src/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ module.exports = {
},
'raw-leaves': {
type: 'boolean',
describe: 'Use raw blocks for leaf nodes. (experimental)',
default: false
describe: 'Use raw blocks for leaf nodes. (experimental)'
},
'cid-version': {
type: 'integer',
Expand Down Expand Up @@ -241,6 +240,10 @@ module.exports = {
}
}

if (options.rawLeaves == null) {
options.rawLeaves = cidVersion > 0
}

const source = file
? globSource(file, {
recursive,
Expand Down
3 changes: 2 additions & 1 deletion packages/ipfs-cli/test/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ describe('add', () => {

ipfs.addAll.withArgs(matchIterable(), {
...defaultOptions,
cidVersion: 1
cidVersion: 1,
rawLeaves: true
}).returns([{
cid,
path: 'README.md'
Expand Down