Skip to content

Commit b7113a8

Browse files
committed
fix(files): ensure throw meaningful error for unsupported encoding in cat()
A test to verify this is available at ipfs-inactive/interface-js-ipfs-core#330 and needs to be merged first. Fixes #799 License: MIT Signed-off-by: Pascal Precht [email protected]
1 parent f3e6bf1 commit b7113a8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/files/cat.js

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

33
const promisify = require('promisify-es6')
44
const cleanCID = require('../utils/clean-cid')
5-
const v = require('is-ipfs')
65
const bl = require('bl')
76

87
module.exports = (send) => {
@@ -13,11 +12,9 @@ module.exports = (send) => {
1312
}
1413

1514
try {
16-
hash = cleanCID(hash)
15+
hash = typeof hash === 'string' ? hash : cleanCID(hash)
1716
} catch (err) {
18-
if (!v.ipfsPath(hash)) {
19-
return callback(err)
20-
}
17+
return callback(err)
2118
}
2219

2320
const query = {

0 commit comments

Comments
 (0)