Summary
The Files tab shows "Failed to load text content" when trying to open any text/markdown file in an agent's workspace. The file is never displayed.
Reproduction
- Navigate to any agent's Files tab
- Click to preview a markdown file (e.g.
CLAUDE.md, README.md)
- The preview panel shows: "Failed to load text content"
Root Cause
The /api/agents/{name}/files/preview endpoint returns a Content-Disposition: attachment header:
Content-Type: text/markdown; charset=utf-8
Content-Disposition: attachment; filename="CLAUDE.md"
The attachment disposition instructs the client to treat the response as a file download rather than displayable content. The frontend receives an HTTP 200 with a body, but the disposition causes it to fail to render the content inline — hence "Failed to load text content".
Fix
Change the Content-Disposition header on the file preview endpoint from:
Content-Disposition: attachment; filename="..."
to:
Content-Disposition: inline; filename="..."
This applies to all text-based file types served by the preview endpoint (.md, .txt, .yaml, .py, .ts, etc.).
Observed on
- Instance: eu2 (Trinity v3a3e9a72)
- File types confirmed affected:
.md (markdown)
- Likely affects all text file types given the header is set at the endpoint level
Expected Behaviour
Clicking a text file in the Files tab displays its content inline in the preview panel.
Summary
The Files tab shows "Failed to load text content" when trying to open any text/markdown file in an agent's workspace. The file is never displayed.
Reproduction
CLAUDE.md,README.md)Root Cause
The
/api/agents/{name}/files/previewendpoint returns aContent-Disposition: attachmentheader:The
attachmentdisposition instructs the client to treat the response as a file download rather than displayable content. The frontend receives an HTTP 200 with a body, but the disposition causes it to fail to render the content inline — hence "Failed to load text content".Fix
Change the
Content-Dispositionheader on the file preview endpoint from:to:
This applies to all text-based file types served by the preview endpoint (
.md,.txt,.yaml,.py,.ts, etc.).Observed on
.md(markdown)Expected Behaviour
Clicking a text file in the Files tab displays its content inline in the preview panel.