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

fix: re-allow passing path to ls #914

Merged
merged 2 commits into from
Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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