From 1173c174525d95dd2a064739f962293fb98d215b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabor=20K=C3=B6rber?= Date: Wed, 15 Apr 2026 20:49:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=89=20allow=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/plugins/react-custom-html-parser.tsx | 12 +++------ src/app/utils/sanitize.ts | 26 +++++--------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index 961131d9..97e2c99a 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -474,14 +474,10 @@ export const getReactCustomHtmlParser = ( } if (name === 'img') { - const htmlSrc = mxcUrlToHttp(mx, props.src, params.useAuthentication); - if (htmlSrc && props.src.startsWith('mxc://') === false) { - return ( - - {props.alt || props.title || htmlSrc} - - ); - } + const isMxc = typeof props.src === 'string' && props.src.startsWith('mxc://'); + const htmlSrc = isMxc + ? mxcUrlToHttp(mx, props.src, params.useAuthentication) + : props.src; if (htmlSrc && 'data-mx-emoticon' in props) { return ( diff --git a/src/app/utils/sanitize.ts b/src/app/utils/sanitize.ts index c199f69a..d9b7867b 100644 --- a/src/app/utils/sanitize.ts +++ b/src/app/utils/sanitize.ts @@ -105,26 +105,12 @@ const transformATag: Transformer = (tagName, attribs) => ({ }, }); -const transformImgTag: Transformer = (tagName, attribs) => { - const { src } = attribs; - if (typeof src === 'string' && src.startsWith('mxc://') === false) { - return { - tagName: 'a', - attribs: { - href: src, - rel: 'noreferrer noopener', - target: '_blank', - }, - text: attribs.alt || src, - }; - } - return { - tagName, - attribs: { - ...attribs, - }, - }; -}; +const transformImgTag: Transformer = (tagName, attribs) => ({ + tagName, + attribs: { + ...attribs, + }, +}); export const sanitizeCustomHtml = (customHtml: string): string => sanitizeHtml(customHtml, {