Skip to content

fix(files): use inline Content-Disposition on preview endpoint (#784) - #785

Merged
vybe merged 1 commit into
devfrom
feature/784-files-inline-preview
May 11, 2026
Merged

vybe merged 1 commit into
devfrom
feature/784-files-inline-preview

Conversation

@vybe

@vybe vybe commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • FileResponse(filename=...) in the agent server sets Content-Disposition: attachment, causing the frontend FilesPanel to fail rendering text files and show "Failed to load text content"
  • Fix: switch to an explicit Content-Disposition: inline; filename="..." header so preview content displays inline
  • Applies to all file types served by the /api/files/preview endpoint (text, images, PDFs, etc.)

Changes

  • docker/base-image/agent_server/routers/files.py — remove filename= param from FileResponse, set Content-Disposition: inline via headers instead
  • tests/test_agent_files.py — add assertion that a successful preview response carries an inline disposition

Test Plan

  • Existing preview tests pass: pytest tests/test_agent_files.py -v -k preview
  • Manual: navigate to any agent's Files tab, click a .md or .txt file — content renders in the preview panel instead of "Failed to load text content"

Fixes #784

Generated with Claude Code

FileResponse(filename=...) caused Starlette to set Content-Disposition:
attachment, which prevented the frontend FilesPanel from rendering text
file content inline. Switch to an explicit inline; filename="..." header
so the preview panel receives and displays text correctly.

Also adds an assertion to the existing preview test that verifies the
response carries an inline disposition.

Fixes #784

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@vybe
vybe merged commit 2c5fab3 into dev May 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant