diff --git a/core/rfb.js b/core/rfb.js index c71d6b88f..f2deb0e7b 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -2356,7 +2356,7 @@ export default class RFB extends EventTargetMixin { textData = textData.slice(0, -1); } - textData = textData.replace("\r\n", "\n"); + textData = textData.replaceAll("\r\n", "\n"); this.dispatchEvent(new CustomEvent( "clipboard", diff --git a/tests/test.rfb.js b/tests/test.rfb.js index c1ee8b16d..62b80ca3f 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -3263,11 +3263,11 @@ describe('Remote Frame Buffer Protocol Client', function () { }); it('should update clipboard with correct escape characters from a Provide message ', function () { - let expectedData = "Oh\nmy!"; + let expectedData = "Oh\nmy\n!"; let data = [3, 0, 0, 0]; const flags = [0x10, 0x00, 0x00, 0x01]; - let text = encodeUTF8("Oh\r\nmy!\0"); + let text = encodeUTF8("Oh\r\nmy\r\n!\0"); let deflatedText = deflateWithSize(text);