From 4137be62a118c08b97d1141821c911079b469c59 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Thu, 9 Jul 2026 16:20:01 +0800 Subject: [PATCH] fix(matrix): preserve mxc markdown image sources --- nanobot/channels/matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanobot/channels/matrix.py b/nanobot/channels/matrix.py index 8a2fc9d8..9e10fe83 100644 --- a/nanobot/channels/matrix.py +++ b/nanobot/channels/matrix.py @@ -18,7 +18,7 @@ from nanobot.security.workspace_policy import is_path_within try: import aiohttp import nh3 - from mistune import create_markdown + from mistune import HTMLRenderer, create_markdown from nio import ( AsyncClient, AsyncClientConfig, @@ -77,7 +77,7 @@ class _MediaTooLargeError(Exception): """Raised when an inbound Matrix media download exceeds the configured cap.""" MATRIX_MARKDOWN = create_markdown( - escape=True, + renderer=HTMLRenderer(escape=True, allow_harmful_protocols=("mxc://",)), plugins=["table", "strikethrough", "url", "superscript", "subscript"], )