Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
fix: adjust split so that /webrtc is not consued with /webrtc-direct
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel-G committed Jun 1, 2023
1 parent 24c2680 commit 3e6c158
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/private-to-private/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class WebRTCTransport implements Transport, Startable {
}

export function splitAddr(ma: Multiaddr): { baseAddr: Multiaddr, peerId: PeerId } {
const addrs = ma.toString().split(WEBRTC_TRANSPORT)
const addrs = ma.toString().split(WEBRTC_TRANSPORT + '/')
if (addrs.length !== 2) {
throw new CodeError('webrtc protocol was not present in multiaddr', codes.ERR_INVALID_MULTIADDR)
}
Expand All @@ -159,7 +159,7 @@ export function splitAddr(ma: Multiaddr): { baseAddr: Multiaddr, peerId: PeerId

// look for remote peerId
let remoteAddr = multiaddr(addrs[0])
const destination = multiaddr(addrs[1])
const destination = multiaddr("/" + addrs[1])

const destinationIdString = destination.getPeerId()
if (destinationIdString == null) {
Expand Down

0 comments on commit 3e6c158

Please sign in to comment.