Skip to content

fix(rss,zip): fix UnboundLocalError in RssConverter and surface ZipConverter failures#1786

Open
AKIB473 wants to merge 1 commit intomicrosoft:mainfrom
AKIB473:fix/rss-converter-unbound-local-and-description
Open

fix(rss,zip): fix UnboundLocalError in RssConverter and surface ZipConverter failures#1786
AKIB473 wants to merge 1 commit intomicrosoft:mainfrom
AKIB473:fix/rss-converter-unbound-local-and-description

Conversation

@AKIB473
Copy link
Copy Markdown

@AKIB473 AKIB473 commented Apr 16, 2026

Summary

Two bug fixes in existing converters, each with tests.


Fix 1 — RssConverter: UnboundLocalError when channel has no <title>

Bug: If an RSS <channel> element has no <title> child, md_text is never initialised but then md_text += is attempted for the description, raising UnboundLocalError: local variable 'md_text' referenced before assignment.

Fix: Initialise md_text = '' unconditionally before the conditional blocks.

Bonus fix in same area: The channel <description> was written raw into the output, while item descriptions already go through _parse_content() for HTML-to-markdown conversion. Applied the same treatment to channel description for consistency.


Fix 2 — ZipConverter: FileConversionException silently swallowed

Bug: When a file inside a ZIP archive cannot be converted, the FileConversionException is caught and silently discarded (pass). Users receive partial output with no indication that files were skipped.

Fix: Include a markdown warning block in the output so users know what was skipped and why:

## File: data.bin

> ⚠️ Could not convert file: data.bin — <reason>

Tests

Three new tests added in packages/markitdown/tests/test_rss_zip_fixes.py:

  • test_rss_no_title_does_not_raise — RSS feed with no <title> must not raise
  • test_rss_channel_description_html_is_cleaned — HTML entities in channel description converted cleanly
  • test_zip_conversion_failure_surfaced_in_output — unconvertible ZIP contents appear as warnings

All 3 pass locally.

…nverter failures

RssConverter:
- Initialize md_text to '' before conditional assignment to prevent
  UnboundLocalError when a channel element has no <title> node
- Pass channel description through _parse_content() for consistent
  HTML-to-markdown conversion (item descriptions already did this)

ZipConverter:
- Surface FileConversionException as a markdown warning block instead
  of silently swallowing it, so users know which files were skipped

Add tests for all three fixes in test_rss_zip_fixes.py
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.

1 participant