From c52401da024b7b7e6a51160f77e5d438031f8f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 12 Apr 2022 15:36:06 -0400 Subject: [PATCH] fix: #10491, don't leak deleted message in cleanedContent --- src/messaging/index.js | 1 + test/messaging.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/messaging/index.js b/src/messaging/index.js index 27998d47a0..0526cab7ae 100644 --- a/src/messaging/index.js +++ b/src/messaging/index.js @@ -48,6 +48,7 @@ Messaging.getMessages = async (params) => { messageData.isOwner = messageData.fromuid === parseInt(params.uid, 10); if (messageData.deleted && !messageData.isOwner) { messageData.content = '[[modules:chat.message-deleted]]'; + messageData.cleanedContent = messageData.content; } }); diff --git a/test/messaging.js b/test/messaging.js index 4929ae23fd..f4ab7e56e1 100644 --- a/test/messaging.js +++ b/test/messaging.js @@ -702,6 +702,7 @@ describe('Messaging Library', () => { assert.ifError(err); messages.forEach((msg) => { assert(!msg.deleted || msg.content === '[[modules:chat.message-deleted]]', msg.content); + assert(!msg.deleted || msg.cleanedContent, '[[modules:chat.message-deleted]]', msg.content); }); done(); }