From e88f7a8f196c9f8bd21c0ef9cced0f439ca18cd9 Mon Sep 17 00:00:00 2001 From: Malte Polley <48649152+Zirkonium88@users.noreply.github.com> Date: Wed, 1 Jul 2026 15:21:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A7=20fix:=20Add=20.eml=20(message/rfc?= =?UTF-8?q?822)=20Support=20to=20File=20Upload=20(#13989)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: add .eml (message/rfc822) support to file upload * chore: restore package lock metadata --------- Co-authored-by: Malte Polley Co-authored-by: Danny Avila --- packages/data-provider/src/file-config.spec.ts | 17 +++++++++++++++++ packages/data-provider/src/file-config.ts | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/packages/data-provider/src/file-config.spec.ts b/packages/data-provider/src/file-config.spec.ts index b564f5a913..c5380c12b6 100644 --- a/packages/data-provider/src/file-config.spec.ts +++ b/packages/data-provider/src/file-config.spec.ts @@ -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', () => { diff --git a/packages/data-provider/src/file-config.ts b/packages/data-provider/src/file-config.ts index 06f6b4806d..8ca650c7e4 100644 --- a/packages/data-provider/src/file-config.ts +++ b/packages/data-provider/src/file-config.ts @@ -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