📂 fix: Respect supportedMimeTypes Config in File Picker Accept Filter#12596
Conversation
The browser file picker's accept attribute was hardcoded by provider identity, ignoring the endpoint's supportedMimeTypes from fileConfig. Users who configured permissive MIME types (e.g., '.*') still saw a restrictive filter in the upload dialog. Add isPermissiveMimeConfig utility that detects wildcard patterns in the endpoint's supportedMimeTypes. When permissive, the file picker accept attribute is set to empty (unrestricted). Non-permissive configs retain the existing provider-based defaults. Closes #12589
29b54a9 to
0dc2c16
Compare
There was a problem hiding this comment.
Pull request overview
Fixes the frontend file picker’s accept filter so endpoints configured with permissive supportedMimeTypes (e.g., '.*') don’t show an artificially restrictive file-type dialog, aligning the UI with the effective backend MIME handling.
Changes:
- Add
isPermissiveMimeConfig()inpackages/data-providerand unit tests to detect permissive MIME regex configurations. - Update
AttachFileMenuto clear the file inputacceptfilter when the endpoint MIME config is permissive. - Add GitNexus indexing + Fly.io deployment workflows/config (not described in the PR metadata and operationally significant).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/data-provider/src/file-config.ts | Adds isPermissiveMimeConfig() helper for permissive MIME regex detection. |
| packages/data-provider/src/file-config.spec.ts | Adds unit tests for isPermissiveMimeConfig() (including convertStringsToRegex path). |
| client/src/components/Chat/Input/Files/AttachFileMenu.tsx | Clears the accept attribute for permissive endpoint MIME configs to avoid restrictive picker filters. |
| .github/workflows/gitnexus-index.yml | Adds a new CI workflow to generate and upload a GitNexus index artifact. |
| .github/workflows/gitnexus-deploy.yml | Adds workflow to deploy the GitNexus index to Fly.io (includes security-sensitive setup guidance). |
| .fly/gitnexus/fly.toml | Adds Fly.io app configuration for the GitNexus service. |
| .fly/gitnexus/entrypoint.sh | Adds container entrypoint to run gitnexus serve behind Caddy. |
| .fly/gitnexus/Dockerfile | Adds container build for GitNexus + Caddy, consuming the CI-produced index artifact. |
| .fly/gitnexus/Caddyfile | Adds bearer-token auth proxy configuration for the GitNexus service. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use non-standard MIME namespace probe (x-librechat/x-probe) so category-wildcard patterns like ^application\/.*$ no longer false-positive as permissive - Add single-line JSDoc to isPermissiveMimeConfig - Use !== undefined instead of != null (fileType is never null) - Add endpointFileConfig to dropdownItems useMemo deps to prevent stale closure when config changes without endpoint change - Add tests for broad application and multi-category patterns
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
handleUploadClick is captured inside the dropdownItems useMemo but was not in its dependency array. Wrap it in useCallback with endpointFileConfig.supportedMimeTypes as the sole dependency, then reference the stable callback in the useMemo deps.
supportedMimeTypes Config in File Picker Accept Filter
…er (danny-avila#12596) * fix: respect supportedMimeTypes config in file picker accept filter The browser file picker's accept attribute was hardcoded by provider identity, ignoring the endpoint's supportedMimeTypes from fileConfig. Users who configured permissive MIME types (e.g., '.*') still saw a restrictive filter in the upload dialog. Add isPermissiveMimeConfig utility that detects wildcard patterns in the endpoint's supportedMimeTypes. When permissive, the file picker accept attribute is set to empty (unrestricted). Non-permissive configs retain the existing provider-based defaults. Closes danny-avila#12589 * fix: address review findings for isPermissiveMimeConfig - Use non-standard MIME namespace probe (x-librechat/x-probe) so category-wildcard patterns like ^application\/.*$ no longer false-positive as permissive - Add single-line JSDoc to isPermissiveMimeConfig - Use !== undefined instead of != null (fileType is never null) - Add endpointFileConfig to dropdownItems useMemo deps to prevent stale closure when config changes without endpoint change - Add tests for broad application and multi-category patterns * fix: wrap handleUploadClick in useCallback to satisfy exhaustive-deps handleUploadClick is captured inside the dropdownItems useMemo but was not in its dependency array. Wrap it in useCallback with endpointFileConfig.supportedMimeTypes as the sole dependency, then reference the stable callback in the useMemo deps.
…er (danny-avila#12596) * fix: respect supportedMimeTypes config in file picker accept filter The browser file picker's accept attribute was hardcoded by provider identity, ignoring the endpoint's supportedMimeTypes from fileConfig. Users who configured permissive MIME types (e.g., '.*') still saw a restrictive filter in the upload dialog. Add isPermissiveMimeConfig utility that detects wildcard patterns in the endpoint's supportedMimeTypes. When permissive, the file picker accept attribute is set to empty (unrestricted). Non-permissive configs retain the existing provider-based defaults. Closes danny-avila#12589 * fix: address review findings for isPermissiveMimeConfig - Use non-standard MIME namespace probe (x-librechat/x-probe) so category-wildcard patterns like ^application\/.*$ no longer false-positive as permissive - Add single-line JSDoc to isPermissiveMimeConfig - Use !== undefined instead of != null (fileType is never null) - Add endpointFileConfig to dropdownItems useMemo deps to prevent stale closure when config changes without endpoint change - Add tests for broad application and multi-category patterns * fix: wrap handleUploadClick in useCallback to satisfy exhaustive-deps handleUploadClick is captured inside the dropdownItems useMemo but was not in its dependency array. Wrap it in useCallback with endpointFileConfig.supportedMimeTypes as the sole dependency, then reference the stable callback in the useMemo deps.
Summary
The browser file picker's
acceptattribute was hardcoded by provider identity inAttachFileMenu.tsx, ignoring the endpoint'ssupportedMimeTypesfromfileConfig. PR #12508 fixed the backend routing so custom MIME types are processed correctly, but the frontend file picker dialog still showed a restrictive filter — confusing users who configured permissive types likesupportedMimeTypes: ['.*'].isPermissiveMimeConfigutility inpackages/data-provider/src/file-config.tsthat detects wildcard patterns by testing a synthetic MIME type (application/x-librechat-any) against the endpoint'ssupportedMimeTypesRegExp arrayhandleUploadClickthat sets the file inputacceptto''(unrestricted) when the endpoint's MIME config is permissive, short-circuiting the hardcoded provider-based strings/.*/,/.+/,/^.*$/,/^.+$/), mixed arrays, category patterns, specific MIME types, defaults, edge cases, and the end-to-endconvertStringsToRegex→isPermissiveMimeConfigpathCloses #12589
Change Type
Testing
fileConfig.endpoints.custom.supportedMimeTypes: ['.*']inlibrechat.yamlcd packages/data-provider && npx jest file-config --verbose— all 113 tests passChecklist