Skip to content

Files tab: 'Failed to load text content' for markdown files — content-disposition: attachment prevents inline rendering #784

Description

@vybe

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

  1. Navigate to any agent's Files tab
  2. Click to preview a markdown file (e.g. CLAUDE.md, README.md)
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions