Repository navigation
Fix markdown remote SVG image loading - #4533
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds ChangesSVG Image Support
Sequence DiagramEstimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 2 warnings)
✅ Passed checks (13 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 098a304. Configure here.
Greptile SummaryThis PR fixes remote SVG image loading in the Markdown viewer by adding
Confidence Score: 5/5Safe to merge — the changes are minimal, correctly structured, and the new exact-match assertion on the Accept header guards against the content-negotiation regression raised in prior review. The Accept header change correctly keeps image/avif;q=0.9 with its own qualifier and adds image/svg+xml;q=0.9 after it. The canonicalization switch is a straightforward passthrough. SVG is served via WKWebView's URL scheme handler as an img response, which sandboxes script execution. The new test asserts the exact Accept header string, providing solid regression coverage for content-negotiation ordering. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "test: pin remote image accept header" | Re-trigger Greptile |
Summary
Testing
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Expands the set of remotely fetched/accepted image MIME types to include SVG, which changes what untrusted content can be rendered and could introduce new parsing/rendering edge cases. Scope is small and covered by targeted regression tests.
Overview
Fixes markdown remote image loading to support SVG: the pinned remote-image request
Acceptheader now includesimage/svg+xml, andMarkdownRemoteImageSecurity.canonicalImageMIMETyperecognizes/normalizesimage/svg+xml(including;charsetvariants).Updates tests to assert SVG MIME canonicalization and to verify the generated request headers include the new
Acceptentry (including an IPv6 host request case).Reviewed by Cursor Bugbot for commit 2d762ce. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Enables consented Markdown remote SVG images by adding
image/svg+xmlto the Accept header and treating it as a valid image type. Keeps AVIF preferred.image/svg+xml;q=0.9to the Accept header while preservingimage/avif;q=0.9priority.image/svg+xml(including;charsetvariants) and pinned the exact Accept header string in tests.Written for commit 2d762ce. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Tests