From e8db9e9bc3f663901601e36effd7d4dca36671c0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 31 Mar 2020 22:37:45 +0200 Subject: [PATCH 1/2] Fix parsed is null error --- transports/wasm-ext/src/websockets.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/transports/wasm-ext/src/websockets.js b/transports/wasm-ext/src/websockets.js index ec868bff6c6..7b96409c7a9 100644 --- a/transports/wasm-ext/src/websockets.js +++ b/transports/wasm-ext/src/websockets.js @@ -33,12 +33,12 @@ export const websocket_transport = () => { // TODO: support dns addresses as well const multiaddr_to_ws = (addr) => { let parsed = addr.match(/^\/(ip4|ip6|dns4|dns6)\/(.*?)\/tcp\/(.*?)\/(ws|wss|x-parity-ws\/(.*)|x-parity-wss\/(.*))$/); - let proto = 'wss'; - if (parsed[4] == 'ws' || parsed[4] == 'x-parity-ws') { - proto = 'ws'; - } - let url = decodeURIComponent(parsed[5] || parsed[6] || ''); if (parsed != null) { + let proto = 'wss'; + if (parsed[4] == 'ws' || parsed[4] == 'x-parity-ws') { + proto = 'ws'; + } + let url = decodeURIComponent(parsed[5] || parsed[6] || ''); if (parsed[1] == 'ip6') { return proto + "://[" + parsed[2] + "]:" + parsed[3] + url; } else { From cf475a259d9d195eb8db6ee71e13c54ee6373a65 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 9 Apr 2020 15:19:49 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53459981bb5..4886e6f8a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ - `libp2p-floodsub`: Allow sent messages seen as subscribed. [PR 1520](https://github.com/libp2p/rust-libp2p/pull/1520) +- `libp2p-wasm-ext`: Fix "parsed is null" errors being thrown. + [PR 1535](https://github.com/libp2p/rust-libp2p/pull/1535) + # Version 0.17.0 (2020-04-02) - `libp2p-core`: Finished "identity hashing" for peer IDs migration.