Skip to content

Commit

Permalink
Fix - js injection in message input (#1943)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM authored Oct 9, 2023
1 parent ce6501e commit ca6c8ee
Showing 1 changed file with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,22 +529,6 @@ export const ChannelInputComponent: React.FC<ChannelInputProps> = ({
direction='column'
justifyContent='center'
>
{/* <MentionPoper anchorEl={anchorEl} selected={selected}>
{mentionsToSelect.map((target, index) => (
<MentionElement
key={index}
name={target.nickname}
highlight={index === selected}
onMouseEnter={() => {
setSelected(index)
}}
channelName={channelName}
onClick={e => {
mentionSelectAction(e)
}}
/>
))}
</MentionPoper> */}
<Grid
container
direction='row'
Expand Down Expand Up @@ -586,18 +570,14 @@ export const ChannelInputComponent: React.FC<ChannelInputProps> = ({
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, '<br />')
document.execCommand('insertHTML', false, text)
}
}}
data-testid='messageInput'
/>
Expand Down

0 comments on commit ca6c8ee

Please sign in to comment.