From 15c478bf58ad7ef8d44f243f050a988fbe57d02b Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Wed, 25 Mar 2020 17:35:52 +0000 Subject: [PATCH] fix: add default args for ipfs.add (#2950) So we don't send invalid args over http. --- src/cli/commands/add.js | 11 +++++------ test/cli/files-regular.js | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/cli/commands/add.js b/src/cli/commands/add.js index 16d749e8d5..de5bd47edf 100644 --- a/src/cli/commands/add.js +++ b/src/cli/commands/add.js @@ -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', @@ -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', @@ -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, @@ -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: () => {} diff --git a/test/cli/files-regular.js b/test/cli/files-regular.js index 1164d6be05..7e99310b01 100644 --- a/test/cli/files-regular.js +++ b/test/cli/files-regular.js @@ -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,