Repository navigation
fix(docx): ignore XML comments and processing instructions - #4627
taran-dev4u wants to merge 1 commit into
Conversation
|
✅ DCO Check Passed Thanks @taran-dev4u, 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/
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Taran Mamidala <mamidalataran6333@gmail.com>
5ea931c to
eb6131f
Compare
AI triage (advisory)Checked commit This PR adds type checks to skip XML comments and processing instructions during DOCX element iteration, and adds a regression test. Topic labels added: CI safety: no concern found. A maintainer must still approve CI. Possible duplicates
2 related pull request(s) in the same code
The |
|
Closing in favor of #4584 which routes XML comments to the NOTES layer per maintainer feedback. |
Closes #4583.
In
MsWordDocumentBackend, XML comments and processing instructions (such as docx4j's<!-- Created by docx4j -->banner or comments in paragraphs and table cells) causedetree.QNameto raiseValueErrorbecause non-element lxml nodes do not have string tags. When present inside table cells, equations and rich-cell checks also raisedTypeErrororAttributeError, causing tables to be dropped as broken.This adds
isinstance(node.tag, str)guards across element iteration paths in the backend so comments and processing instructions are skipped cleanly, and adds a regression unit test covering document body, paragraph, run, table row, and cell locations.