fix: set inline disposition for renderable blob elements#2950
Open
axelray-dev wants to merge 1 commit into
Open
fix: set inline disposition for renderable blob elements#2950axelray-dev wants to merge 1 commit into
axelray-dev wants to merge 1 commit into
Conversation
SQLAlchemyDataLayer.create_element never passed content_disposition to storage_provider.upload_file, so Azure Blob Storage defaulted to Content-Disposition: attachment. This caused PDF elements (and other browser-renderable types) to render blank on chat resume because the browser refused to display them in an iframe. Set content_disposition='inline' for browser-renderable MIME types (application/pdf, image/*, audio/*, video/*) while preserving the existing behavior (None) for non-renderable uploads like generic files. Fixes Chainlit#2946 Co-Authored-By: OpenAI Codex <[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.
Fixes #2946
Summary
SQLAlchemyDataLayer.create_element never passed content_disposition to storage_provider.upload_file. Azure Blob Storage defaults to Content-Disposition: attachment in this case, which causes browser-renderable elements (PDF, images, audio, video) to render blank on chat resume because iframes and media tags refuse to display content served with an attachment disposition.
This fix sets content_disposition='inline' for browser-renderable MIME types while preserving the existing behavior for non-renderable uploads.
Scope
Only browser-renderable MIME types are affected:
All other element types (generic files, text/plain, application/octet-stream, etc.) keep content_disposition=None, preserving the existing download behavior.
Changes
Testing
Backend tests run locally:
Note: pre-commit hooks could not run locally (frontend build OOMs on VPS). CI will verify lint and format.
Backward Compatibility
This change is fully backward-compatible per AGENTS.md requirements:
Summary by cubic
Force inline Content-Disposition for renderable blob uploads so PDFs, images, audio, and video display correctly in iframes/media on chat resume. Leaves non-renderable files unchanged.
content_disposition='inline'forapplication/pdf,image/*,audio/*,video/*inSQLAlchemyDataLayer.create_element.content_disposition=Nonefor others (e.g.,text/plain,application/octet-stream) to preserve download behavior.Written for commit afe6d49. Summary will update on new commits.