fix: make file uri links clickable#1867
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
ApprovabilityVerdict: Approved This is a straightforward bug fix that makes file:// URI links clickable in markdown by transforming them to direct paths. The changes are self-contained to URL handling in markdown rendering, well-tested with both unit and browser tests, and have no security or infrastructure implications. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
What Changed
Sometimes codex likes to output links as a file uri instead of just making the link the path as we'd expect. This pr strips the
file://so these links are clickable again.UI Changes
N/A
Checklist
Note
Low Risk
Low risk: small, well-scoped change to markdown link transformation with added unit/browser tests; main risk is unexpected URL rewriting edge cases for non-file links.
Overview
Fixes
file://links in chat markdown so they’re clickable.ChatMarkdownnow uses a customurlTransformto rewritefile:URIs into plain filesystem-pathhrefs (preserving#L…anchors) while falling back toreact-markdown’sdefaultUrlTransformfor everything else.Adds
rewriteMarkdownFileUriHref(and extendsparseFileUrlHrefto optionally avoid decoding) to prevent double-decoding issues, plus new unit tests and a browser-levelChatMarkdowntest verifying rewrittenhrefs and editor-open behavior.Reviewed by Cursor Bugbot for commit 7f7b0b9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix file URI links to be clickable in ChatMarkdown
rewriteMarkdownFileUriHrefin markdown-links.ts to convertfile://URIs to direct filesystem paths, preserving hash anchors and keeping path octets encoded for single-pass decoding downstream.urlTransformprop onReactMarkdown, falling back todefaultUrlTransformfor non-file URLs.openInPreferredEditorwith the resolved path and optional line number.Macroscope summarized 7f7b0b9.