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

fix: add default args for ipfs.add #2950

Merged
merged 2 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion packages/ipfs-http-client/src/lib/to-url-search-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const mtimeToObject = require('./mtime-to-object')
module.exports = (args, options) => {
const searchParams = new URLSearchParams(options)

if (args === undefined) {
if (args === undefined || args === null) {
args = []
} else if (!Array.isArray(args)) {
args = [args]
Expand Down
11 changes: 5 additions & 6 deletions packages/ipfs/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
1 change: 0 additions & 1 deletion packages/ipfs/test/cli/files-regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function defaultAddArgs (overrides) {
pin: true,
chunker: 'size-262144',
preload: true,
nonatomic: undefined,
fileImportConcurrency: 50,
blockWriteConcurrency: 10,
progress: sinon.match.func,
Expand Down