Skip to content

fix: make file uri links clickable#1867

Merged
juliusmarminge merged 2 commits intomainfrom
yash/file-uri-links
Apr 10, 2026
Merged

fix: make file uri links clickable#1867
juliusmarminge merged 2 commits intomainfrom
yash/file-uri-links

Conversation

@Yash-Singh1
Copy link
Copy Markdown
Collaborator

@Yash-Singh1 Yash-Singh1 commented Apr 10, 2026

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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

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. ChatMarkdown now uses a custom urlTransform to rewrite file: URIs into plain filesystem-path hrefs (preserving #L… anchors) while falling back to react-markdown’s defaultUrlTransform for everything else.

Adds rewriteMarkdownFileUriHref (and extends parseFileUrlHref to optionally avoid decoding) to prevent double-decoding issues, plus new unit tests and a browser-level ChatMarkdown test verifying rewritten hrefs 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

  • Adds rewriteMarkdownFileUriHref in markdown-links.ts to convert file:// URIs to direct filesystem paths, preserving hash anchors and keeping path octets encoded for single-pass decoding downstream.
  • Wires this into ChatMarkdown.tsx via a urlTransform prop on ReactMarkdown, falling back to defaultUrlTransform for non-file URLs.
  • Clicking a rewritten link continues to call openInPreferredEditor with the resolved path and optional line number.

Macroscope summarized 7f7b0b9.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fa096c2c-8407-4ba2-8c3f-5a43bf18fe9a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yash/file-uri-links

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 and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

Verdict: 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 7f7b0b9. Prior analysis still applies.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge merged commit 592c234 into main Apr 10, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the yash/file-uri-links branch April 10, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants