Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 442bcdd

Browse files
author
Alan Shaw
authoredDec 15, 2018
fix: re-allow passing path to ls (#914)
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>
1 parent fdaf776 commit 442bcdd

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"eslint-plugin-react": "^7.11.1",
8787
"go-ipfs-dep": "~0.4.18",
8888
"gulp": "^3.9.1",
89-
"interface-ipfs-core": "~0.92.0",
89+
"interface-ipfs-core": "~0.93.0",
9090
"ipfsd-ctl": "~0.40.0",
9191
"nock": "^10.0.2",
9292
"pull-stream": "^3.6.9",

‎src/files-regular/ls-pull-stream.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const moduleConfig = require('../utils/module-config')
44
const pull = require('pull-stream')
55
const deferred = require('pull-defer')
6+
const IsIpfs = require('is-ipfs')
67
const cleanCID = require('../utils/clean-cid')
78

89
module.exports = (arg) => {
@@ -17,7 +18,9 @@ module.exports = (arg) => {
1718
try {
1819
args = cleanCID(args)
1920
} catch (err) {
20-
return callback(err)
21+
if (!IsIpfs.ipfsPath(args)) {
22+
return callback(err)
23+
}
2124
}
2225

2326
const p = deferred.source()

‎src/files-regular/ls-readable-stream.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const moduleConfig = require('../utils/module-config')
44
const Stream = require('readable-stream')
5+
const IsIpfs = require('is-ipfs')
56
const cleanCID = require('../utils/clean-cid')
67

78
module.exports = (arg) => {
@@ -16,7 +17,9 @@ module.exports = (arg) => {
1617
try {
1718
args = cleanCID(args)
1819
} catch (err) {
19-
return callback(err)
20+
if (!IsIpfs.ipfsPath(args)) {
21+
return callback(err)
22+
}
2023
}
2124

2225
const pt = new Stream.PassThrough({ objectMode: true })

‎src/files-regular/ls.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const promisify = require('promisify-es6')
4+
const IsIpfs = require('is-ipfs')
45
const moduleConfig = require('../utils/module-config')
56
const cleanCID = require('../utils/clean-cid')
67

@@ -16,7 +17,9 @@ module.exports = (arg) => {
1617
try {
1718
args = cleanCID(args)
1819
} catch (err) {
19-
return callback(err)
20+
if (!IsIpfs.ipfsPath(args)) {
21+
return callback(err)
22+
}
2023
}
2124

2225
send({

0 commit comments

Comments
 (0)
This repository has been archived.