Skip to content

fix: decode HTML entities in news feed API responses#659

Merged
bokelley merged 2 commits into
mainfrom
bokelley/fix-html-entities-news
Jan 7, 2026
Merged

fix: decode HTML entities in news feed API responses#659
bokelley merged 2 commits into
mainfrom
bokelley/fix-html-entities-news

Conversation

@bokelley

@bokelley bokelley commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixed HTML entity encoding issue where entities like ' (apostrophe) were appearing literally in news feed titles instead of being decoded
  • Created shared decodeHtmlEntities utility for consistent HTML entity decoding across the codebase
  • Applied decoding to /api/latest/sections/:slug/articles and /api/latest/featured endpoints
  • Consolidated duplicate implementations from feed-fetcher.ts, committees.ts, and http.ts

Test plan

  • Verified API returns decoded titles via curl http://localhost:3000/api/latest/featured?limit=3
  • All 187 tests pass including new html-entities.test.ts (8 test cases)
  • TypeScript compiles without errors

🤖 Generated with Claude Code

bokelley and others added 2 commits January 7, 2026 04:18
RSS feeds sometimes contain HTML entities like ' (apostrophe) that
weren't being decoded before being displayed in the API responses.

Changes:
- Create shared decodeHtmlEntities utility in server/src/utils/html-entities.ts
- Apply HTML entity decoding in /api/latest/sections/:slug/articles endpoint
- Apply HTML entity decoding in /api/latest/featured endpoint
- Apply HTML entity decoding in admin feeds route for article titles
- Consolidate duplicate decodeHtmlEntities implementations across codebase
- Add unit tests for the HTML entities utility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit 50c7b0d into main Jan 7, 2026
6 checks passed
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