Skip to content

Commit

Permalink
fix: re-allow passing path to ls (ipfs#914)
Browse files Browse the repository at this point in the history
This was accidentally disabled and no tests existed to catch it.

* [x] depends on ipfs-inactive/interface-js-ipfs-core#420

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
Alan Shaw authored Dec 15, 2018
1 parent fdaf776 commit 442bcdd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/files-regular/ls-pull-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion src/files-regular/ls-readable-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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 })
Expand Down
5 changes: 4 additions & 1 deletion src/files-regular/ls.js
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -16,7 +17,9 @@ module.exports = (arg) => {
try {
args = cleanCID(args)
} catch (err) {
return callback(err)
if (!IsIpfs.ipfsPath(args)) {
return callback(err)
}
}

send({
Expand Down

0 comments on commit 442bcdd

Please sign in to comment.