From 1d1d8ab9039a2f00495fd351bde31fea7aaed105 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakovenko Date: Wed, 17 Jun 2020 15:34:46 +0200 Subject: [PATCH] Update loopback.js On a mac loopbackAnswer contains \\r\\n characters instead of proper line breaks. Because of that initial regex /a=crypto:[1-9]+ .*/g matches everything starting from a=crypto:1 all the way to the end of loopbackAnswer, and when replaced for an empty string it corrupts the json. As a solution, I propose to first search-and-replace "mac-specific" crypto patterns (crypto all the way to first \\r\\n sequence) and only after that search-and-replace original patterns (crypto all the way to the end of the line). --- src/web_app/js/loopback.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web_app/js/loopback.js b/src/web_app/js/loopback.js index 2e1ab95ad..afa70a48e 100644 --- a/src/web_app/js/loopback.js +++ b/src/web_app/js/loopback.js @@ -72,6 +72,7 @@ function setupLoopback(wssUrl, roomId) { // https://bugs.chromium.org/p/chromium/issues/detail?id=616263 // https://bugs.chromium.org/p/chromium/issues/detail?id=1077740 loopbackAnswer = loopbackAnswer + .replace(/a=crypto:[1-9]+ .*?\\r\\n/g, '') .replace(/a=crypto:[1-9]+ .*/g, ''); sendLoopbackMessage(JSON.parse(loopbackAnswer)); } else if (message.type === 'candidate') {