Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c607971

Browse files
lidelAlan Shaw
authored andcommitted
fix: preload addreses with trailing slash (#2377)
Switches to latest multiaddr-to-uri and removes code that is no longer needed (the lib assumes http by default now: multiformats/js-multiaddr-to-uri#7) Closes #2333 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
1 parent 3cade67 commit c607971

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"mime-types": "^2.1.21",
142142
"mkdirp": "~0.5.1",
143143
"multiaddr": "^6.1.0",
144-
"multiaddr-to-uri": "^4.0.1",
144+
"multiaddr-to-uri": "^5.0.0",
145145
"multibase": "~0.6.0",
146146
"multicodec": "~0.5.5",
147147
"multihashes": "~0.4.14",

src/core/preload.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = self => {
3232

3333
let stopped = true
3434
let requests = []
35-
const apiUris = options.addresses.map(apiAddrToUri)
35+
const apiUris = options.addresses.map(toUri)
3636

3737
const api = (cid, callback) => {
3838
callback = callback || noop
@@ -84,10 +84,3 @@ module.exports = self => {
8484

8585
return api
8686
}
87-
88-
function apiAddrToUri (addr) {
89-
if (!(addr.endsWith('http') || addr.endsWith('https'))) {
90-
addr = addr + '/http'
91-
}
92-
return toUri(addr)
93-
}

0 commit comments

Comments
 (0)