Support uploading any file type, not just images#3
Merged
Conversation
Extends the upload system from image-only to general file uploads (PDFs, text, archives, code, docs, etc.). Images render inline as before; non-image files appear as styled download links with the original filename. Changes: - Media: expand allowed MIME types, add ext_for map, bump limit to 10MB - ChatLive: accept any file type, show file icon + name for non-images - MCP bridge: remove image-only enum, add optional filename param - ToolsController: pass filename option, update error messages - CSS: file preview cards in composer and download link styling - JS: open file download links in new tab (skip lightbox) - Tests: unit tests for all new file types, e2e Playwright tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Separate the default value header from the clause bodies to satisfy the Elixir compiler (warnings-as-errors clean). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously, save/3 guarded against a whitelist of ~40 MIME types and rejected anything else. Now any file type is accepted — the only rejection is on file size (>10MB). The ext_map and filename fallback still provide good extension detection for unknown types. Also fixes invalid `E` regex modifier in config/dev.exs that prevented compilation on Elixir <1.16. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
Latest update: Removed MIME type allowlist entirelyCommit: Changes
Test resultsAll 211 tests + 13 properties pass. What this meansPreviously the system supported ~40 whitelisted MIME types. Now it truly supports any file type — 🤖 Generated with Claude Code |
The message form was missing phx-change, which meant LiveView's LiveFileUpload hook never called trackFiles() on file input changes. Uploads appeared broken in both the browser and Playwright e2e tests. - Add phx-change="validate" to the message form - Add no-op validate handler for form change events - Update e2e spec with triggerLiveViewUpload helper that re-dispatches change events for LiveView compatibility Co-Authored-By: hive-dev <noreply@hive.dev> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
[📎 report.pdf](/uploads/abc.pdf))filenameparameterChanges
lib/hive/media.ex@allowed_typesto ~30 MIME types, added@ext_mapfor extension lookup,image_type?/1helper, optionalfilenamekwarglib/hive_web/live/chat_live.exallow_uploadaccepts:any, file icon + name preview for non-images,format_attachments_markdown/1differentiates images vs filessdk/hive_mcp_bridge.jsenumonmedia_type, added optionalfilenameparam, updated descriptionslib/hive_web/controllers/tools_controller.exfilenameoption through toMedia.save, updated error messageassets/css/app.css/uploads/URLs in messagesassets/js/app.jstest/hive/media_test.exsext_for/2,image_type?/1test/hive_web/controllers/tools_controller_test.exse2e/file-upload.spec.tsTest plan
mix test test/hive/media_test.exs— unit tests for all new file typesmix test test/hive_web/controllers/tools_controller_test.exs— API integration testsnpx playwright test e2e/file-upload.spec.ts— e2e upload flowupload_mediaMCP tool withmedia_type: 'application/pdf'🤖 Generated with Claude Code