mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 07:20:29 +03:00
fix crash when decoding malformed urls (#1865)
This commit is contained in:
parent
8ed78d48fb
commit
581211f13e
5 changed files with 20 additions and 8 deletions
|
|
@ -26,6 +26,7 @@ import {
|
|||
testMatrixTo,
|
||||
} from './matrix-to';
|
||||
import { onEnterOrSpace } from '../utils/keyboard';
|
||||
import { tryDecodeURIComponent } from '../utils/dom';
|
||||
|
||||
const ReactPrism = lazy(() => import('./react-prism/ReactPrism'));
|
||||
|
||||
|
|
@ -134,8 +135,8 @@ export const factoryRenderLinkifyWithMention = (
|
|||
attributes,
|
||||
content,
|
||||
}) => {
|
||||
if (tagName === 'a' && testMatrixTo(decodeURIComponent(attributes.href))) {
|
||||
const mention = mentionRender(decodeURIComponent(attributes.href));
|
||||
if (tagName === 'a' && testMatrixTo(tryDecodeURIComponent(attributes.href))) {
|
||||
const mention = mentionRender(tryDecodeURIComponent(attributes.href));
|
||||
if (mention) return mention;
|
||||
}
|
||||
|
||||
|
|
@ -325,11 +326,11 @@ export const getReactCustomHtmlParser = (
|
|||
}
|
||||
}
|
||||
|
||||
if (name === 'a' && testMatrixTo(decodeURIComponent(props.href))) {
|
||||
if (name === 'a' && testMatrixTo(tryDecodeURIComponent(props.href))) {
|
||||
const mention = renderMatrixMention(
|
||||
mx,
|
||||
roomId,
|
||||
decodeURIComponent(props.href),
|
||||
tryDecodeURIComponent(props.href),
|
||||
makeMentionCustomProps(params.handleMentionClick)
|
||||
);
|
||||
if (mention) return mention;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue