From 442bcdd3919b94975721513451c71ed2abfdac2e Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Sat, 15 Dec 2018 19:31:37 +0000 Subject: [PATCH] fix: re-allow passing path to ls (#914) This was accidentally disabled and no tests existed to catch it. * [x] depends on https://github.com/ipfs/interface-ipfs-core/pull/420 License: MIT Signed-off-by: Alan Shaw --- package.json | 2 +- src/files-regular/ls-pull-stream.js | 5 ++++- src/files-regular/ls-readable-stream.js | 5 ++++- src/files-regular/ls.js | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7c2673013..cf0155a2f 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "eslint-plugin-react": "^7.11.1", "go-ipfs-dep": "~0.4.18", "gulp": "^3.9.1", - "interface-ipfs-core": "~0.92.0", + "interface-ipfs-core": "~0.93.0", "ipfsd-ctl": "~0.40.0", "nock": "^10.0.2", "pull-stream": "^3.6.9", diff --git a/src/files-regular/ls-pull-stream.js b/src/files-regular/ls-pull-stream.js index a647825fc..c82d54f62 100644 --- a/src/files-regular/ls-pull-stream.js +++ b/src/files-regular/ls-pull-stream.js @@ -3,6 +3,7 @@ const moduleConfig = require('../utils/module-config') const pull = require('pull-stream') const deferred = require('pull-defer') +const IsIpfs = require('is-ipfs') const cleanCID = require('../utils/clean-cid') module.exports = (arg) => { @@ -17,7 +18,9 @@ module.exports = (arg) => { try { args = cleanCID(args) } catch (err) { - return callback(err) + if (!IsIpfs.ipfsPath(args)) { + return callback(err) + } } const p = deferred.source() diff --git a/src/files-regular/ls-readable-stream.js b/src/files-regular/ls-readable-stream.js index c249f5b64..7ee980e31 100644 --- a/src/files-regular/ls-readable-stream.js +++ b/src/files-regular/ls-readable-stream.js @@ -2,6 +2,7 @@ const moduleConfig = require('../utils/module-config') const Stream = require('readable-stream') +const IsIpfs = require('is-ipfs') const cleanCID = require('../utils/clean-cid') module.exports = (arg) => { @@ -16,7 +17,9 @@ module.exports = (arg) => { try { args = cleanCID(args) } catch (err) { - return callback(err) + if (!IsIpfs.ipfsPath(args)) { + return callback(err) + } } const pt = new Stream.PassThrough({ objectMode: true }) diff --git a/src/files-regular/ls.js b/src/files-regular/ls.js index 67549ecd8..8fbc2d16e 100644 --- a/src/files-regular/ls.js +++ b/src/files-regular/ls.js @@ -1,6 +1,7 @@ 'use strict' const promisify = require('promisify-es6') +const IsIpfs = require('is-ipfs') const moduleConfig = require('../utils/module-config') const cleanCID = require('../utils/clean-cid') @@ -16,7 +17,9 @@ module.exports = (arg) => { try { args = cleanCID(args) } catch (err) { - return callback(err) + if (!IsIpfs.ipfsPath(args)) { + return callback(err) + } } send({