From 2080f31f785b189b67a2f2849ab278dde0184cc1 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 7 Dec 2018 09:17:39 +0000 Subject: [PATCH 1/2] fix: CID parsing for cat/get/ls in HTTP API License: MIT Signed-off-by: Alan Shaw --- package.json | 2 +- src/http/api/resources/files-regular.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9673d77075..d1f51beaab 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "ipfs-multipart": "~0.1.0", "ipfs-repo": "~0.26.0", "ipfs-unixfs": "~0.1.16", - "ipfs-unixfs-engine": "~0.35.2", + "ipfs-unixfs-engine": "~0.35.3", "ipld": "~0.20.1", "ipld-bitcoin": "~0.1.8", "ipld-dag-pb": "~0.15.0", diff --git a/src/http/api/resources/files-regular.js b/src/http/api/resources/files-regular.js index c8fae5112f..aaffa8d12c 100644 --- a/src/http/api/resources/files-regular.js +++ b/src/http/api/resources/files-regular.js @@ -1,6 +1,6 @@ 'use strict' -const mh = require('multihashes') +const CID = require('cids') const multipart = require('ipfs-multipart') const debug = require('debug') const tar = require('tar-stream') @@ -51,7 +51,7 @@ exports.parseKey = (request, reply) => { } try { - mh.fromB58String(key) + new CID(key) // eslint-disable-line } catch (err) { log.error(err) return reply({ From f88e9812119c609decaeb66fe4b922ed5bf197b7 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Tue, 11 Dec 2018 19:57:31 +0000 Subject: [PATCH 2/2] fix: disable just the rule we're breaking License: MIT Signed-off-by: Alan Shaw Co-Authored-By: alanshaw --- src/http/api/resources/files-regular.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/api/resources/files-regular.js b/src/http/api/resources/files-regular.js index aaffa8d12c..cbbf91a5f0 100644 --- a/src/http/api/resources/files-regular.js +++ b/src/http/api/resources/files-regular.js @@ -51,7 +51,7 @@ exports.parseKey = (request, reply) => { } try { - new CID(key) // eslint-disable-line + new CID(key) // eslint-disable-line no-new } catch (err) { log.error(err) return reply({