loleaflet/src/core/Socket.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 77be7d6e18e5a5deb04d1424fd187271e8d2b7a8 Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Aug 21 19:36:49 2016 +0530 loleaflet: Prevent double-decoding utf8; fixes context menu Text messages are already utf8 decoded, so we only need to decode if its a binary message, not otherwise. This also fixes context menu invocation on the UI as in some cases double-decoding of utf8 strings would throw a URI malformed error. This problem started to appear after we explicitly started sending context menu payload as text message rather than binary message in ecd33e1b07793d83396f22fad38ef70cb33e4612 diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index f2f3672..29e7059 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -206,8 +206,11 @@ L.Socket = L.Class.extend({ textMsg = this._utf8ToString(imgBytes); } } - // Decode UTF-8. - textMsg = decodeURIComponent(window.escape(textMsg)); + + // Decode UTF-8 in case it is binary frame + if (typeof e.data === 'object') { + textMsg = decodeURIComponent(window.escape(textMsg)); + } } else { var data = imgBytes.subarray(index + 1); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits