From 4f21befdc89d2d6e51eaa1b6d0309decce1b4fc3 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 15 May 2019 16:47:04 +0100 Subject: [PATCH] fix: config set with number (#998) Anything that isn't a string needs to be passed with `--json`. fixes #881 Depends on: * [x] https://github.com/ipfs/interface-js-ipfs-core/pull/470 License: MIT Signed-off-by: Alan Shaw --- package.json | 2 +- src/config/set.js | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 608b51511..eb876d139 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "dirty-chai": "^2.0.1", "eslint-plugin-react": "^7.11.1", "go-ipfs-dep": "0.4.19", - "interface-ipfs-core": "~0.100.1", + "interface-ipfs-core": "~0.101.0", "ipfsd-ctl": "~0.42.0", "nock": "^10.0.2", "stream-equal": "^1.1.1" diff --git a/src/config/set.js b/src/config/set.js index ae36a75b5..0fa933565 100644 --- a/src/config/set.js +++ b/src/config/set.js @@ -16,14 +16,12 @@ module.exports = (send) => { return callback(new Error('Invalid value type')) } - if (typeof value === 'object') { - value = JSON.stringify(value) - opts = { json: true } - } - if (typeof value === 'boolean') { value = value.toString() opts = { bool: true } + } else if (typeof value !== 'string') { + value = JSON.stringify(value) + opts = { json: true } } send({