-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Summary
When using confluence_update_page with content_format="markdown", any image referencing a page attachment by filename (e.g. ) is silently converted to a raw HTML <img> tag. Confluence cannot resolve bare filenames as page attachments, so every such image renders as "Preview unavailable" on the published page.
This is a silent data-corruption bug — the tool succeeds, returns no error, and the page looks fine in the API response. The breakage is only visible when a human opens the page.
Steps to reproduce
- Attach an image (
chart.png) to a Confluence page. - Call
confluence_update_pagewithcontent_format="markdown"and content:
- Open the page in Confluence → image slot shows "Preview unavailable".
Root cause
The markdown→storage conversion (via md2conf) emits:
<img alt="Revenue chart" src="chart.png"/>Confluence Storage Format does not support <img src="..."> for page attachments. The correct representation is:
<ac:image ac:alt="Revenue chart">
<ri:attachment ri:filename="chart.png"/>
</ac:image>External URLs (src="https://...") render fine — only bare filenames and relative paths are affected.
Fix
Post-process the storage HTML from markdown_to_confluence_storage to replace bare-filename <img> tags with ac:image / ri:attachment macros. External URLs and absolute paths pass through unchanged.
I have a working fix with regression tests and will submit a PR linked to this issue.