Repository navigation
feat(email): parse email attachments - #3978
DanielNg0729 wants to merge 6 commits into
Conversation
|
✅ DCO Check Passed Thanks @DanielNg0729, all your commits are properly signed off. 🎉 |
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hi Dr @dolfim-ibm, just wanted to kindly follow up on this PR too. This is ready for review when you have a moment. Thank you very much! |
|
Great initiative! Our team is eagerly waiting for this recursive attachment parsing feature to be merged. 🚀 |
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
863674e to
bfaf044
Compare
AI triage (advisory)Checked commit Adds an opt-in CI safety: no concern found. A maintainer must still approve CI. 1 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at bfaf044033. It read the code and did not run it.
The feature is opt-in, and the base64 and size-limit paths look correct. The main risk is that attachments past max_attachments are dropped without any note. This conflicts with the PR claim that nothing is silently dropped. Check that behavior, and check how DocumentConverter() is created per email.
A maintainer makes the merge decision. This review never approves the pull request.
…max_attachments Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since bfaf044033 at 9d12e6f78f. It read the code and did not run it.
The new changes address both earlier findings. I found no new defect. The email backend now notes attachments over max_attachments, and all emails share one cached attachment converter. The limit that attachments use default options is now documented.
Earlier findings
- fixed (question): A new
DocumentConverter()per email ignores user pipeline options and reloads pipelines - fixed (suggestion): Attachments over
max_attachmentsare dropped with no note
A maintainer makes the merge decision. This review never approves the pull request.
Signed-off-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
|
Hi Dr @dolfim-ibm, Dr @PeterStaar-IBM , i also wanted to kindly follow up on this PR too. This is ready for review when you have a moment. Thank you very much! |
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
1 similar comment
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
|
Hi @dolfim-ibm, @PeterStaar-IBM, i wanted to kindly follow up on this PR too. I just rebased this with the latest main to resolve the conflict. This is ready for review when you have a moment. Thank you very much |
|
@DanielNg0729 Thanks a lot for your effort on this PR! |
Hi maintainers, this PR is to follow-up to #3873 and #3909 to now actually parse the attachment instead of just listing it.
#3873 added
.eml/.msgparsing and optional listing of attachment names, this PR optionally parses the attachments themselves.Summary
With
EmailBackendOptions(process_attachments=True), Docling converts each attachment and adds its content under an "Attachments" section, with one subsection per attachment. A PDF, DOCX, PPTX, XLSX, image or HTML attachment goes through the same pipeline as a standalone document (layout, tables, OCR, ...), with the default options of its format.If Docling cannot parse an attachment (unsupported format, missing optional dependency, corrupt bytes), the attachment gets a
name (content_type): could not be parsed by Docling.note. Each count or size limit also leaves a note. No attachment is dropped without a trace.How it works
mail-parserrepresentation for.emland.msg, so both formats use one code path. The backend decodes base64 and quoted-printable payloads.core) must not importDocumentConverter(layerentrypoints). Sodocument_converter.pyinjects a factory withregister_attachment_converter_factory(). If no factory is registered, the backend lists the attachments instead.functools.cache). The pipelines and models load once per process, not once per email.DoclingDocument.add_document(child, parent=<attachment heading>)merges each converted attachment into the email document..eml/.msgis parsed, but its own attachments are not.max_attachments(default 32),max_attachment_bytes(default 25 MB) andmax_attachment_total_bytes(default 100 MB).Known limits
format_options(for examplePdfPipelineOptionsfor OCR, tables or the accelerator) and theallowed_formatsof your converter do not apply to attachments. Theprocess_attachmentsdescription anddocs/usage/supported_formats.mdstate this.ConversionResult.errors, and the status staysSUCCESS, because the backend has no access to the conversion result.Usage
Set
list_attachments=Trueinstead to only list attachment names/types without parsing them (the previous behavior).Checklist: