Skip to content

Commit

Permalink
fix: add default args for ipfs.add (ipfs#2950)
Browse files Browse the repository at this point in the history
So we don't send invalid args over http.
  • Loading branch information
achingbrain authored Mar 25, 2020
1 parent 323c29c commit 15c478b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ module.exports = {
},
'raw-leaves': {
type: 'boolean',
describe: 'Use raw blocks for leaf nodes. (experimental)'
describe: 'Use raw blocks for leaf nodes. (experimental)',
default: false
},
'cid-version': {
type: 'integer',
Expand All @@ -89,7 +90,8 @@ module.exports = {
hash: {
type: 'string',
choices: Object.keys(mh.names),
describe: 'Hash function to use. Will set CID version to 1 if used. (experimental)'
describe: 'Hash function to use. Will set CID version to 1 if used. (experimental)',
default: 'sha2-256'
},
quiet: {
alias: 'q',
Expand Down Expand Up @@ -174,9 +176,7 @@ module.exports = {
const { ipfs, print, isDaemon, getStdin } = argv.ctx
const options = {
trickle: argv.trickle,
shardSplitThreshold: argv.enableShardingExperiment
? argv.shardSplitThreshold
: Infinity,
shardSplitThreshold: argv.shardSplitThreshold,
cidVersion: argv.cidVersion,
rawLeaves: argv.rawLeaves,
onlyHash: argv.onlyHash,
Expand All @@ -185,7 +185,6 @@ module.exports = {
pin: argv.pin,
chunker: argv.chunker,
preload: argv.preload,
nonatomic: argv.nonatomic,
fileImportConcurrency: argv.fileImportConcurrency,
blockWriteConcurrency: argv.blockWriteConcurrency,
progress: () => {}
Expand Down
7 changes: 3 additions & 4 deletions test/cli/files-regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ const HASH_ALGS = [
function defaultAddArgs (overrides) {
return {
trickle: false,
shardSplitThreshold: Infinity,
shardSplitThreshold: 1000,
cidVersion: 0,
rawLeaves: undefined,
rawLeaves: false,
onlyHash: false,
hashAlg: undefined,
hashAlg: 'sha2-256',
wrapWithDirectory: false,
pin: true,
chunker: 'size-262144',
preload: true,
nonatomic: undefined,
fileImportConcurrency: 50,
blockWriteConcurrency: 10,
progress: sinon.match.func,
Expand Down

0 comments on commit 15c478b

Please sign in to comment.