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

Commit

Permalink
fix: use getPeerId to determine if /ipfs fragment is required
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Sep 3, 2017
1 parent 736b699 commit 4ae47e6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/components/pre-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const peerId = require('peer-id')
const PeerInfo = require('peer-info')
const multiaddr = require('multiaddr')
const waterfall = require('async/waterfall')
const mafmt = require('mafmt')

/*
* Load stuff from Repo into memory
Expand All @@ -26,7 +25,7 @@ module.exports = function preStart (self) {
config.Addresses.Swarm.forEach((addr) => {
let ma = multiaddr(addr)

if (mafmt.IPFS.matches(ma) && !ma.protoNames().indexOf('ipfs') > -1) {
if (ma.getPeerId()) {
ma = ma.encapsulate('/ipfs/' + self._peerInfo.id.toB58String())
}

Expand Down

0 comments on commit 4ae47e6

Please sign in to comment.