Repository navigation
fix(email): preserve furniture from HTML message bodies - #5228
Conversation
Signed-off-by: Wayne <36395303+BrownieCoder@users.noreply.github.com>
|
✅ DCO Check Passed Thanks @BrownieCoder, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The email backend now keeps text from HTML CI safety: no concern found. A maintainer must still approve CI. 2 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 4d1c25cca6. It read the code and did not run it.
I found no defect that blocks the merge. The change in docling/backend/email_backend.py exports the HTML body once per content layer, then adds each paragraph with its layer. This matches how the HTML backend marks footers as furniture, and the HTML options already set infer_furniture=False, so only <footer> text lands in the furniture layer.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Wayne <36395303+BrownieCoder@users.noreply.github.com>
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since 4d1c25cca6 at 340a9926c0. It read the code and did not run it.
I found no defect that blocks the merge. In docling/backend/email_backend.py, _get_body_paragraphs exports each content layer of the HTML body separately and keeps the plain-text-first order. The new calendar test in the incremental diff checks existing fallback behavior and does not cover this fix. I could not check it against the mailparser source, because the dependency was not installed in the workspace.
A maintainer makes the merge decision. This review never approves the pull request.
Description
HTML-only emails lost text inside
<footer>elements during conversion. The HTML backend kept the text, but the email backend dropped the furniture layer when converting it to Markdown.Keep footer text on
ContentLayer.FURNITURE. It is available in JSON and when Markdown explicitly includes that layer. Default Markdown still exports the body, and non-empty plain-text alternatives remain preferred.Fixes the remaining footer loss in #5219. Double escaping was already fixed on main; #4877 handles image placeholders separately.
Testing
The footer regressions fail on main and pass with the fix. Tests cover HTML-only messages, blank plain-text alternatives, footer-only messages, multipart HTML, escaping, and the text-body fallback. They also compare the document model, JSON, and default/all-layer exports.
pytest -q tests/test_backend_email.py tests/test_backend_html.py: 175 passed, 1 optional Playwright test skipped.pytest -q tests/test_input_doc.py -k "email or eml or msg": 3 passed.make validate: passed.Full
make checkstops at 17 existing file-length violations, also reproduced on clean main. The full model/OCR suite was not run locally. Tested with Python 3.12.4 and docling-core 2.106.0.Checklist