Skip to content

Fix RSS enclosure media types - #1135

Open
tannerlinsley wants to merge 2 commits into
mainfrom
agent/fix-rss-enclosure-media-types
Open

Fix RSS enclosure media types#1135
tannerlinsley wants to merge 2 commits into
mainfrom
agent/fix-rss-enclosure-media-types

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Aug 10, 2026

Copy link
Copy Markdown
Member

Evidence

The RSS route hardcoded every blog image enclosure as image/png. Among the current 50 published posts, the feed includes 24 PNG, 13 JPG, 4 WebP, 2 JPEG, and 1 SVG header images. That left 20 enclosure media types inconsistent with their URLs.

Change

Derive the enclosure media type from the image extension, including query strings and fragments, and use application/octet-stream for unknown extensions. Add focused regression coverage for the supported formats and fallback.

Impact

RSS consumers now receive media metadata that matches each blog header asset. Enclosure URLs, post content, and site rendering are unchanged.

Validation

  • pnpm test — TypeScript and type-aware lint clean; 124 tests passed, 1 environment-gated smoke test skipped
  • git diff --check
  • Commit hook reran formatting and the full test gate successfully

Risk

Low. The change only corrects RSS enclosure metadata; it does not alter asset URLs or response bodies.

Summary by CodeRabbit

  • Bug Fixes

    • RSS feeds now report the correct media type for images based on their file extension.
    • Image URLs with query parameters or fragments are handled correctly.
    • Unknown image formats use a safe fallback media type, improving compatibility with RSS readers and other feed consumers.
  • Tests

    • Added coverage for common image formats, including PNG, JPEG, WebP, SVG, and GIF, as well as unsupported extensions.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 7a55af7 Commit Preview URL

Branch Preview URL
Aug 10 2026, 05:48 PM

@tannerlinsley tannerlinsley added the source-audit Tracked by the automated source audit label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 38aead41-a76c-417a-819c-1e14de4fa786

📥 Commits

Reviewing files that changed from the base of the PR and between 878187c and 7a55af7.

📒 Files selected for processing (2)
  • src/routes/rss[.]xml.ts
  • tests/rss.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/routes/rss[.]xml.ts
  • tests/rss.test.ts

📝 Walkthrough

Walkthrough

The RSS route detects image MIME types from header image extensions, ignores query strings and fragments, and uses application/octet-stream for unknown URLs. Tests cover supported mappings and fallback behavior.

Changes

RSS image media types

Layer / File(s) Summary
Image media-type detection
src/routes/rss[.]xml.ts, tests/rss.test.ts
getRssImageMediaType maps supported image extensions to MIME types. Tests cover common extensions, URL suffixes, and unknown extensions.
RSS enclosure integration
src/routes/rss[.]xml.ts
RSS enclosure type attributes now use the detected image media type.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change to RSS enclosure media types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-rss-enclosure-media-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/routes/rss`[.]xml.ts:
- Line 16: Update the extension detection expression in the RSS route to inspect
only the URL pathname, excluding query parameters and fragments before matching.
Preserve the existing lowercase extension behavior and supported-type lookup,
while ensuring dotted values in queries or fragments cannot determine the MIME
type.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2667c399-120e-4214-859c-e03afe3c0bab

📥 Commits

Reviewing files that changed from the base of the PR and between 19b0f00 and 878187c.

📒 Files selected for processing (2)
  • src/routes/rss[.]xml.ts
  • tests/rss.test.ts

Comment thread src/routes/rss[.]xml.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

source-audit Tracked by the automated source audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant