Skip to content

Commit

Permalink
fix(files): ensure throw meaningful error for unsupported encoding in…
Browse files Browse the repository at this point in the history
… `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 pascal.precht@gmail.com
  • Loading branch information
0x-r4bbit committed Jul 18, 2018
1 parent f3e6bf1 commit b7113a8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/files/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const promisify = require('promisify-es6')
const cleanCID = require('../utils/clean-cid')
const v = require('is-ipfs')
const bl = require('bl')

module.exports = (send) => {
Expand All @@ -13,11 +12,9 @@ module.exports = (send) => {
}

try {
hash = cleanCID(hash)
hash = typeof hash === 'string' ? hash : cleanCID(hash)
} catch (err) {
if (!v.ipfsPath(hash)) {
return callback(err)
}
return callback(err)
}

const query = {
Expand Down

0 comments on commit b7113a8

Please sign in to comment.