Skip to content

fix: fall back to plain text when RSS item content triggers RecursionError - #2333

Merged
Adam Fourney (afourney) merged 3 commits into
microsoft:mainfrom
shoemoney:fix/rss-recursion-fallback
Aug 31, 2026
Merged

Adam Fourney (afourney) merged 3 commits into
microsoft:mainfrom
shoemoney:fix/rss-recursion-fallback

Conversation

@shoemoney

Copy link
Copy Markdown
Contributor

RssConverter._parse_content wraps markdownify conversion in a broad except BaseException that returns the original content. When an RSS item's description or content:encoded contains deeply nested HTML (roughly 400+ levels), markdownify's recursive DOM traversal raises RecursionError, and the converter silently embeds the raw unconverted HTML in the markdown output.

This PR mirrors the fix merged in #1644 for the HTML converter: catch RecursionError specifically, emit a warning, and fall back to BeautifulSoup's iterative get_text() so callers still get usable plain-text content. Other exceptions keep the existing behavior.

Includes a deterministic regression test using the same sys.setrecursionlimit pattern as the #1644 test: a feed item with 500 nested divs must produce text output with no raw HTML tags. Before the fix the output contained 500 raw <div tags; after, none. black --check clean.

…Error

Deeply nested HTML inside an RSS item's description or content:encoded
previously hit the broad except in _parse_content and returned the raw
unconverted HTML, silently embedding HTML tags in the markdown output.

Catch RecursionError specifically and fall back to BeautifulSoup's
iterative get_text(), mirroring the HTML converter fix from microsoft#1644.
Includes a deterministic regression test.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a plain-text fallback for deeply nested HTML in RSS/Atom item content.

Changes:

  • Catches RecursionError, emits a warning, and extracts readable text.
  • Adds deterministic regression coverage for deeply nested RSS content.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
_rss_converter.py Implements the RSS content fallback.
test_module_misc.py Tests fallback output and warning behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@afourney
Adam Fourney (afourney) merged commit 4752813 into microsoft:main Aug 31, 2026
3 checks passed
@afourney

Copy link
Copy Markdown
Member

Thanks for the contribution. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants