📧 fix: Add .eml (message/rfc822) Support to File Upload (#13989)

* fix: add .eml (message/rfc822) support to file upload

* chore: restore package lock metadata

---------

Co-authored-by: Malte Polley <ahabsfriend@posteo.de>
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Malte Polley 2026-07-01 15:21:14 +02:00 committed by GitHub
parent b20abb2593
commit e88f7a8f19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -66,6 +66,19 @@ describe('inferMimeType', () => {
it('should reject raw text/x-markdown without normalization', () => {
expect(baseFileConfig.checkType('text/x-markdown')).toBe(false);
});
it('should infer message/rfc822 from extension when browser type is empty', () => {
expect(inferMimeType('email.eml', '')).toBe('message/rfc822');
});
it('should pass through message/rfc822 when browser reports it', () => {
expect(inferMimeType('email.eml', 'message/rfc822')).toBe('message/rfc822');
});
it('should produce a type accepted by checkType for .eml files', () => {
const normalized = inferMimeType('test.eml', '');
expect(baseFileConfig.checkType(normalized)).toBe(true);
});
});
describe('applicationMimeTypes', () => {
@ -148,6 +161,10 @@ describe('supportedMimeTypes', () => {
])('ODF type flows through supportedMimeTypes: %s', (mimeType) => {
expect(checkSupported(mimeType)).toBe(true);
});
it('message/rfc822 (.eml) flows through supportedMimeTypes', () => {
expect(checkSupported('message/rfc822')).toBe(true);
});
});
describe('documentParserMimeTypes', () => {

View file

@ -69,6 +69,7 @@ export const fullMimeTypesList = [
'application/vnd.oasis.opendocument.graphics',
'image/svg',
'image/svg+xml',
'message/rfc822',
// Video formats
'video/mp4',
'video/avi',
@ -228,6 +229,8 @@ export const supportedMimeTypes = [
audioMimeTypes,
/** Supported by LC Code Interpreter API */
/^image\/(svg|svg\+xml)$/,
/** .eml email files */
/^message\/rfc822$/,
];
export const codeInterpreterMimeTypes = [
@ -284,6 +287,7 @@ export const codeTypeMapping: { [key: string]: string } = {
cljs: 'text/plain', // .cljs - ClojureScript source
cljc: 'text/plain', // .cljc - Clojure common source
elm: 'text/plain', // .elm - Elm source
eml: 'message/rfc822', // .eml - Email message (RFC 822)
erl: 'text/plain', // .erl - Erlang source
hrl: 'text/plain', // .hrl - Erlang header
ex: 'text/plain', // .ex - Elixir source