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

fix(files): ensure throw meaningful error for unsupported encoding in cat() #804

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
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