Skip to content

Commit 3fdefa3

Browse files
authored
Merge pull request matrix-org#5279 from Sorunome/soru/fix-img-rendering
fix img tags not always being rendered correctly
2 parents 3d7358d + 34c15b5 commit 3fdefa3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/HtmlUtils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const BIGEMOJI_REGEX = new RegExp(`^(${EMOJIBASE_REGEX.source})+$`, 'i');
5353

5454
const COLOR_REGEX = /^#[0-9a-fA-F]{6}$/;
5555

56-
const PERMITTED_URL_SCHEMES = ['http', 'https', 'ftp', 'mailto', 'magnet'];
56+
export const PERMITTED_URL_SCHEMES = ['http', 'https', 'ftp', 'mailto', 'magnet'];
5757

5858
/*
5959
* Return true if the given string contains emoji

src/components/views/elements/ReplyThread.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
2929
import {Action} from "../../../dispatcher/actions";
3030
import sanitizeHtml from "sanitize-html";
3131
import {UIFeature} from "../../../settings/UIFeature";
32+
import {PERMITTED_URL_SCHEMES} from "../../../HtmlUtils";
3233

3334
// This component does no cycle detection, simply because the only way to make such a cycle would be to
3435
// craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would
@@ -106,6 +107,9 @@ export default class ReplyThread extends React.Component {
106107
{
107108
allowedTags: false, // false means allow everything
108109
allowedAttributes: false,
110+
// we somehow can't allow all schemes, so we allow all that we
111+
// know of and mxc (for img tags)
112+
allowedSchemes: [...PERMITTED_URL_SCHEMES, 'mxc'],
109113
exclusiveFilter: (frame) => frame.tag === "mx-reply",
110114
},
111115
);

0 commit comments

Comments
 (0)