fix(html): handle declaration-only documents without TypeError#4412
Open
santhreal wants to merge 1 commit into
Open
fix(html): handle declaration-only documents without TypeError#4412santhreal wants to merge 1 commit into
santhreal wants to merge 1 commit into
Conversation
lxml HTMLParser returns None for inputs like <?xml ...?> and <!DOCTYPE html>, and strip_elements then raised TypeError. Treat a None root as an empty html document so partition_html/partition_md degrade to [].
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Shadow auto-approve: would auto-approve. Fixes a clear crash for declaration-only HTML by inserting a minimal fallback root. The change is bounded and purely a bug fix.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lxml HTMLParser returns None for declaration-only input such as or , and strip_elements then TypeErrors. Re-parse a minimal so partition_html returns [].