#16069·chatwoot

具有相对 URL 或格式不正确 URL 的 Markdown 图像的消息会抛出 TypeError: 无效 URL

作者: sarmah-rup创建于 2026年9月29日更新于 2026年9月29日

描述错误 MessageFormatter 为包含 markdown 图像的任何消息抛出 TypeError: Invalid URL,其中 src 不是绝对 URL,例如相对路径(/uploads/a.png、logo.png)或格式不正确的 URL(http://)。app/JavaScript/shared/helpers/MessageFormatter.js 中的 setImageSizing 使用 new URL(imgSrc) 读取 cw_image_width 和 cw_image_height 参数,没有基础 URL。这对于 https://... 源是有效的,对于其他情况则会抛出错误。格式化器渲染仪表板消息气泡(components-next/message/bubbles/Text/FormattedContent.vue)、回复预览(bubbles/Base.vue)和小组件消息,消息内容可以直接来自联系人,因此只需要一个这样的图像就足以阻止该消息被格式化。

内容来源: chatwoot/chatwoot