From f4dca75c6ddc56d21dc44684ab3b19c833444265 Mon Sep 17 00:00:00 2001 From: Emi Date: Mon, 9 Oct 2023 14:54:28 +0200 Subject: [PATCH] Fix js injection in message input --- .../channels/ChannelInput/ChannelInput.tsx | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/desktop/src/renderer/components/widgets/channels/ChannelInput/ChannelInput.tsx b/packages/desktop/src/renderer/components/widgets/channels/ChannelInput/ChannelInput.tsx index 3297a6c5b5..313d5be148 100644 --- a/packages/desktop/src/renderer/components/widgets/channels/ChannelInput/ChannelInput.tsx +++ b/packages/desktop/src/renderer/components/widgets/channels/ChannelInput/ChannelInput.tsx @@ -529,22 +529,6 @@ export const ChannelInputComponent: React.FC = ({ direction='column' justifyContent='center' > - {/* - {mentionsToSelect.map((target, index) => ( - { - setSelected(index) - }} - channelName={channelName} - onClick={e => { - mentionSelectAction(e) - }} - /> - ))} - */} = ({ onChange={onChangeCb} onKeyDown={onKeyDownCb} onPaste={async e => { - e.preventDefault() const files = e.clipboardData.files + if (files.length) e.preventDefault() for (let i = 0; i < files.length; i++) { const fileExt = path.extname(files[i].name).toLowerCase() const fileName = path.basename(files[i].name, fileExt) const arrayBuffer = await files[i].arrayBuffer() handleClipboardFiles(arrayBuffer, fileExt, fileName) } - if (!files.length) { - const text = e.clipboardData.getData('text/plain').replace(/(\r\n|\r|\n)/g, '
') - document.execCommand('insertHTML', false, text) - } }} data-testid='messageInput' />