fix(news): unwrap CDATA titles at ingest and on /api/news

Excelsior rows store the feed's CDATA wrapper as the title text, including
the surrounding whitespace. Strip a whole-title wrapper before insert and
again on GET /api/news so existing rows read clean without an UPDATE.
Plain titles and real HTML are unchanged.
This commit is contained in:
Sirius DevOps 2026-11-14 00:47:04 -05:00
commit 13a4049137
6 changed files with 154 additions and 1 deletions

View file

@ -57,6 +57,7 @@ from camera_scraper import is_public_url
from sources import GDELT_API, ingest_rss_feed, ingest_gdelt, ingest_earthquakes, ingest_social_signals
from fire_sources import ingest_fires
from keystore import KeyFormatError, delete_key, list_keys, set_key
from news_title import unwrap_cdata_title
from settings_store import SettingsError, get_app_settings, list_models, set_summary_model
from live_layers import (
fetch_aircraft, fetch_fire_incidents, fetch_fire_perimeters,
@ -1348,7 +1349,7 @@ async def list_news(
rows = (await session.execute(stmt)).mappings().all()
return [
NewsArticleOut(
id=r["id"], title=r["title"], url=r["url"],
id=r["id"], title=unwrap_cdata_title(r["title"]), url=r["url"],
content=r["content"] if include_content else None, domain=r["domain"],
timestamp=r["timestamp"],
)