Repository navigation
fix(parser): match the .eml extension in any case - #20090
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe ChangesEML extension handling
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Uppercase and mixed-case .eml filenames are handled by the email parser. No actionable merge risk remains after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the suffix with care, Comment |
|
@devYRPauli pls help to check if go side has this issue as well. |
|
The Go side does not have this issue. Every Go path lowercases the extension or the file type before it compares it:
I also ran The red |
|
LGTM. @devYRPauli pls rebase from latest code to resolve ci issue. Thank you. |
|
Main removed The file still exists on |
|
@devYRPauli I guess python & golang are splitted. Golang goes to 1.0 (RC) and python goes to 0.27.XXX. |
Parser._email compared the extension with ".eml" case-sensitively. A file named MESSAGE.EML or Mail.Eml went to the .msg branch, and extract_msg.Message failed on the RFC 5322 bytes: FileNotFoundError for a short message, InvalidFileFormatError for a 4 KB one. Upload type detection and the pipeline suffix dispatch already lowercase the name, and the Go email parser lowercases the extension. Lowercase it here too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
e296844 to
c56ccde
Compare
|
Retargeted to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 0.27.x #20090 +/- ##
=======================================
Coverage 38.01% 38.01%
=======================================
Files 54 54
Lines 15511 15511
Branches 125 125
=======================================
Hits 5896 5896
Misses 9587 9587
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
The pipeline email parser fails on an
.emlfile whose extension is not lower case. A file namedMESSAGE.EMLorMail.Emlproduces no email content.Parser._emailcompares the extension with".eml"case-sensitively (rag/flow/parser/parser.py:1270). Any other spelling goes to the.msgbranch. That branch passes the RFC 5322 bytes toextract_msg.Message, which expects an Outlook OLE2 file.The upper-case name does reach
_email.filename_typelowercases the name before it matcheseml(api/utils/file_utils.py:55). The pipeline dispatch lowercases the suffix before it selects theemailsetup (rag/flow/parser/parser.py:1445), then passes the original name to_email. Onmain, the Go email parser lowercases the extension before it selects the.msgbranch (internal/parser/parser/email_parser.go:89).Measured on
0.27.x(1a730e34e) with the same.emlbytes under different names:message.eml(control)MESSAGE.EML, short messageFileNotFoundErrorfromolefile, which reads the bytes as a pathMail.Eml, short messageFileNotFoundErrorMESSAGE.EML, 4249-byte messageextract_msg.exceptions.InvalidFileFormatError: not an OLE2 structured storage fileThe change lowercases the extension before the comparison.
exthas no other use in_email.Test:
test_eml_extension_matches_in_any_caseintest/unit_test/rag/flow/parser/test_email_attachments.py. It parses one.emlunder the namesMESSAGE.EMLandMail.Eml, and checks the subject and the body. With the fix reverted, both cases fail:With the fix, the whole module passes (11 passed).
ruff checkandruff format --checkpass on both changed files.