fix: RSS feed metadata leakage and PPTX table pipe escaping#1785
Open
JasonOA888 wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: RSS feed metadata leakage and PPTX table pipe escaping#1785JasonOA888 wants to merge 1 commit intomicrosoft:mainfrom
JasonOA888 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Two bugs fixed: 1. RSS/Atom converter: _get_data_by_tag_name() used getElementsByTagName() which recursively searches all descendants. This caused item/entry-level metadata (title, description) to leak into channel/feed-level fields when the channel/feed lacked its own title or description. Added _get_direct_child_data() that only searches immediate child elements. Also fixed UnboundLocalError when channel has no title. 2. PPTX converter: table cells containing pipe characters (|) were not escaped, producing broken markdown tables with extra columns. Added pipe escaping in _convert_table_to_markdown().
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.
Summary
Two bugs found and fixed in the converter layer.
Bug 1: RSS/Atom metadata leakage
_get_data_by_tag_name()usedgetElementsByTagName()which recursively searches all descendants. When a channel/feed lacked its own<title>or<description>, the method would return the first matching element from an<item>/<entry>instead, causing:titleinDocumentConverterResultFix: Added
_get_direct_child_data()that only searches immediate child elements, and used it for channel/feed-level metadata. Also fixedUnboundLocalErrorwhenchannel_titleisNoneandchannel_descriptionis not.Bug 2: PPTX table pipe escaping
_convert_table_to_markdown()usedhtml.escape()on cell text, which does not escape pipe characters (|). When cell content contained|, the resulting markdown table had extra columns.Fix: Added
.replace("|", "\|")afterhtml.escape().Reproduction
RSS bug:
PPTX bug:
Test plan
outlookoptional dep)