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

Commit

Permalink
fix: preload addreses with trailing slash (#2377)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lidel authored and Alan Shaw committed Aug 21, 2019
1 parent 3cade67 commit c607971
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.5",
"multihashes": "~0.4.14",
Expand Down
9 changes: 1 addition & 8 deletions src/core/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

0 comments on commit c607971

Please sign in to comment.