From 1598640c802af0a718b50f7519ecc49d4a260f41 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 1 Jun 2021 14:56:43 +0200 Subject: [PATCH] Remove line-breaks from message image markup We use `white-space: pre-wrap` to render the messages, so line-breaks in the markup add unnecessary space. --- src/plugins/muc-views/tests/xss.js | 14 +++++++------- src/shared/directives/image.js | 6 ++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/muc-views/tests/xss.js b/src/plugins/muc-views/tests/xss.js index 26ba8cfba..cd82a20b4 100644 --- a/src/plugins/muc-views/tests/xss.js +++ b/src/plugins/muc-views/tests/xss.js @@ -11,13 +11,13 @@ describe("XSS", function () { await mock.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo'); /* - * - * - * - * - * " - */ + * from="oo@conference.chat.example.org/<img src="x" onerror="alert(123)"/>"> + * + * + * + * + * " + */ const presence = $pres({ to:'romeo@montague.lit/pda', from:"lounge@montague.lit/<img src="x" onerror="alert(123)"/>" diff --git a/src/shared/directives/image.js b/src/shared/directives/image.js index 14f9592e3..16695c364 100644 --- a/src/shared/directives/image.js +++ b/src/shared/directives/image.js @@ -6,16 +6,14 @@ import { html } from 'lit'; class ImageDirective extends AsyncDirective { render (src, href, onLoad, onClick) { - return html` - this.onError(src, href, onLoad, onClick)} @load=${onLoad} - /> - `; + />`; } onError (src, href, onLoad, onClick) {