From 18736ff00c70447464d7d9ca3d033eb1acda173a Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 21 Aug 2019 12:37:33 +0200 Subject: [PATCH] fix: preload addreses with trailing slash Switches to latest multiaddr-to-uri and removes code that is no longer needed (the lib assumes http by default now: https://github.com/multiformats/js-multiaddr-to-uri/pull/7) Closes #2333 License: MIT Signed-off-by: Marcin Rataj --- package.json | 2 +- src/core/preload.js | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index eaac00bfcd..2bef50ff2b 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "mime-types": "^2.1.21", "mkdirp": "~0.5.1", "multiaddr": "^6.1.0", - "multiaddr-to-uri": "^4.0.1", + "multiaddr-to-uri": "^5.0.0", "multibase": "~0.6.0", "multicodec": "~0.5.1", "multihashes": "~0.4.14", diff --git a/src/core/preload.js b/src/core/preload.js index 983b0445d1..605e3350dc 100644 --- a/src/core/preload.js +++ b/src/core/preload.js @@ -32,7 +32,7 @@ module.exports = self => { let stopped = true let requests = [] - const apiUris = options.addresses.map(apiAddrToUri) + const apiUris = options.addresses.map(toUri) const api = (cid, callback) => { callback = callback || noop @@ -84,10 +84,3 @@ module.exports = self => { return api } - -function apiAddrToUri (addr) { - if (!(addr.endsWith('http') || addr.endsWith('https'))) { - addr = addr + '/http' - } - return toUri(addr) -}