Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9c8bc58

Browse files
committed
Hide inline images when preference disabled
As a first attempt, this drops inline images (as if they were not present at all) when the "show images" preference is disabled. Future work might expose some UI to reveal them like standalone image events have. Fixes element-hq/element-web#15573
1 parent 557d9ad commit 9c8bc58

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/HtmlUtils.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import EMOJIBASE_REGEX from 'emojibase-regex';
2929
import url from 'url';
3030

3131
import {MatrixClientPeg} from './MatrixClientPeg';
32+
import SettingsStore from './settings/SettingsStore';
3233
import {tryTransformPermalinkToLocalHref} from "./utils/permalinks/Permalinks";
3334
import {SHORTCODE_TO_EMOJI, getEmojiFromUnicode} from "./emoji";
3435
import ReplyThread from "./components/views/elements/ReplyThread";
@@ -171,7 +172,7 @@ const transformTags: IExtendedSanitizeOptions["transformTags"] = { // custom to
171172
// Strip out imgs that aren't `mxc` here instead of using allowedSchemesByTag
172173
// because transformTags is used _before_ we filter by allowedSchemesByTag and
173174
// we don't want to allow images with `https?` `src`s.
174-
if (!attribs.src || !attribs.src.startsWith('mxc://')) {
175+
if (!attribs.src || !attribs.src.startsWith('mxc://') || !SettingsStore.getValue("showImages")) {
175176
return { tagName, attribs: {}};
176177
}
177178
attribs.src = MatrixClientPeg.get().mxcUrlToHttp(

0 commit comments

Comments
 (0)