You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(html): make huge_tree opt-in via UNSTRUCTURED_HTML_HUGE_TREE env var
Per @cragwolfe review: huge_tree=True disables libxml2's safety guards
against malicious inputs (https://lxml.de/FAQ.html), so it must remain
opt-in. Default stays huge_tree=False; set UNSTRUCTURED_HTML_HUGE_TREE
to 1/true/yes to enable for trusted inputs.
- Add test confirming default behavior drops nodes silently (matches
prior behavior — no regression for existing users).
- Test for the opt-in path patches the parser since it's built at
module import time.
- Updated changelog to document the env var and the security tradeoff.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
### Fixes
4
4
5
-
-**Parse large/deeply nested HTML documents**: `partition_html` previously returned an empty element list for HTML with deep subtree nesting because the module-level `etree.HTMLParser` used lxml's default `huge_tree=False`, which silently drops nodes past the default depth limit. Enable `huge_tree=True`on the parser so deep documents round-trip correctly (#4289).
5
+
-**Parse large/deeply nested HTML documents (opt-in)**: `partition_html` previously returned an empty element list for HTML with deep subtree nesting because the module-level `etree.HTMLParser` used lxml's default `huge_tree=False`, which silently drops nodes past the default depth limit. Set the `UNSTRUCTURED_HTML_HUGE_TREE` environment variable to `1`/`true`/`yes` to enable `huge_tree=True`and parse deeply nested documents. The default remains `False` because `huge_tree=True` disables libxml2's safety guards against malicious inputs (see https://lxml.de/FAQ.html) (#4289).
0 commit comments