From b7113a8e47899803a02cd473d8664df92008dcce Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Wed, 4 Jul 2018 14:44:32 +0200 Subject: [PATCH] fix(files): ensure throw meaningful error for unsupported encoding in `cat()` A test to verify this is available at https://github.com/ipfs/interface-ipfs-core/pull/330 and needs to be merged first. Fixes #799 License: MIT Signed-off-by: Pascal Precht pascal.precht@gmail.com --- src/files/cat.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/files/cat.js b/src/files/cat.js index ff468eb34..e4aa57632 100644 --- a/src/files/cat.js +++ b/src/files/cat.js @@ -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) => { @@ -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 = {