Repository navigation
fix(files): use inline Content-Disposition on preview endpoint (#784) - #785
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FileResponse(filename=...)in the agent server setsContent-Disposition: attachment, causing the frontend FilesPanel to fail rendering text files and show "Failed to load text content"Content-Disposition: inline; filename="..."header so preview content displays inline/api/files/previewendpoint (text, images, PDFs, etc.)Changes
docker/base-image/agent_server/routers/files.py— removefilename=param fromFileResponse, setContent-Disposition: inlinevia headers insteadtests/test_agent_files.py— add assertion that a successful preview response carries aninlinedispositionTest Plan
pytest tests/test_agent_files.py -v -k preview.mdor.txtfile — content renders in the preview panel instead of "Failed to load text content"Fixes #784
Generated with Claude Code