Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 62cc3cf

Browse files
author
Alan Shaw
committedDec 14, 2018
fix: re-allow passing path to ls
This was accidentally disabled and no tests existed to catch it. * [ ] depends on ipfs-inactive/interface-js-ipfs-core#420 License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
1 parent fdaf776 commit 62cc3cf

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
 

‎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.