Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): command-click spaced folder links #6439

MergedSunkenInTime(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/6439/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Problem

Valid Markdown file links that used angle-bracket destinations containing spaces were skipped by the chat link pre-scan. React Markdown then rendered them as ordinary browser links, so Command-click could not open a linked folder in the preferred editor.

Fix

  • recognize angle-bracket Markdown destinations that contain spaces
  • resolve the percent-encoded href emitted by the Markdown renderer as a local path
  • route Command-click on macOS and Control-click on other platforms to the preferred editor while preserving normal-click preview behavior

User impact

Folder and file links with spaces now render as local-path chips, and the platform modifier opens their resolved path in the preferred editor.

Validation

  • pnpm exec vp test run apps/web/src/markdown-links.test.ts
  • pnpm exec vp run --filter @t3tools/web typecheck
  • targeted Vite+ lint and formatting checks for the three changed files

Generated by GPT-5.6-sol through the Codex harness in T3 Code.

Note

  • Expands RELATIVE_FILE_PATH_PATTERN in markdown-links.ts to allow spaces in path segments, so paths like docs/My Folder/file.md are recognized as file links.
  • Adds extractMarkdownLinkHrefs and shouldOpenMarkdownFileLinkInEditor to markdown-links.ts, centralizing logic previously duplicated in ChatMarkdown.tsx.
  • Updates MarkdownFileLink to open the file in the editor on command/ctrl-click, falling back to browser or preview on plain click.
  • Adds a fallback in the ChatMarkdown anchor renderer to resolve link metadata on the fly for links not pre-indexed in the memoized map.
Macroscope summarized 693c762.

Note

Low Risk Link parsing and click routing in chat markdown only; no auth or data-handling changes. Slight risk of over-matching relative paths that contain spaces.

Overview Chat markdown now treats angle-bracket file links with spaces as local paths, so they render as file chips instead of ordinary browser links.

Href extraction understands <path with spaces>, relative path matching allows spaces in segments, and percent-encoded hrefs from the renderer are decoded when resolving. Command-click (macOS) / Control-click (elsewhere) opens the resolved path in the preferred editor; a plain click still previews. Unindexed links fall back to on-the-fly resolveMarkdownFileLinkMeta.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 693c7624664900ab53b56e8ea74216670d7291c1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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 Plus

      Run ID: 38040f3e-24d7-4aad-952f-2f060c17d385

      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

      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.
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      An unresolved blocking review comment identifies that the fix is incomplete: relative spaced paths like docs/My%20Folder still fail to resolve because RELATIVE_FILE_PATH_PATTERN doesn't allow spaces after URL decoding. This substantive bug should be addressed before merging.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. one blocking regression remains in relative spaced folder links. targeted tests, typecheck, lint, formatting, and terminal-link tests pass, but a production renderer/classifier probe shows the relative case is still treated as an ordinary browser link.

      @@ -37,3 +41,5 @@
      3741 "/workspace/",
      3842 "/workspaces/",
      3943 ] as const;
      44+const MARKDOWN_LINK_HREF_PATTERN =
      45+ /\[[^\]]*]\(\s*(?:<([^>\n]+)>|([^\s)]+))(?:\s+["'][^"']*["'])?\s*\)/g;

      blocking: this scanner now accepts relative destinations such as [folder](<docs/My Folder>), but resolveMarkdownFileLinkTarget still rejects the rendered docs/My%20Folder because RELATIVE_FILE_PATH_PATTERN does not allow spaces after decoding. i reproduced this through react-markdown: [folder](docs/MyFolder) resolves to /repo/project/docs/MyFolder, while the equivalent spaced destination resolves to null and remains an ordinary browser link. please update relative path classification and add a renderer-to-classifier regression test for this valid shape.

    5. t3-code-bot[bot](GitHub profile, opens in a new tab) approved these changes

      verified the prior relative spaced-folder blocker at the production renderer/classifier boundary. targeted link tests, terminal-link tests, web typecheck, lint, formatting, and all required ci checks pass.

    6. markdown-links.test.ts on the PR files against today's workspace: 39/39.

      The old pre-scan /\[[^\]]*]\(([^)\s]+)…/ cannot see ](<path with spaces>). The new pattern takes the angle-bracket group first, and resolveMarkdownFileLinkMeta decodes the %20 href React Markdown actually emits. The renderer-round-trip test ([folder](<docs/My Folder>) → docs/My%20Folder → decoded target) is the one that would fail if either half broke.

      shouldOpenMarkdownFileLinkInEditor is Cmd on MacIntel, Ctrl otherwise — right for this Windows box. I did not click a chip in the running app.

      APPROVED and MERGEABLE.

Sign in to join this conversation.