Skip to content

fix(server): normalize file tree paths to POSIX separators#691

Merged
unhappychoice merged 1 commit intomainfrom
fix/677-tree-view-filename
May 6, 2026
Merged

fix(server): normalize file tree paths to POSIX separators#691
unhappychoice merged 1 commit intomainfrom
fix/677-tree-view-filename

Conversation

@unhappychoice
Copy link
Copy Markdown
Owner

Summary

  • Tree view leaf nodes on Windows displayed the full path (e.g. internal\Benchmark\plan.md) instead of just the filename, because the backend emitted OS-native separators while the frontend split on /.
  • Normalize all path values returned from /api/filetree to POSIX (/) form via a toPosixPath helper. Backend consumers (/api/markdown, /api/outline, /api/diff) all go through path.join(directory, filePath) or git CLI, both of which accept POSIX paths on Windows.
  • Also fixes getGitStatus, which compared OS-native entryPath against git's POSIX-format f.path and would never match on Windows.

Closes #677

Test plan

  • npx jest test/unit/server/routes/filetree.test.ts — all 6 tests pass, including new regression test that simulates path.sep = '\\' and verifies returned paths contain no backslashes.
  • Manual verification on Windows: tree view leaf labels show only the filename.

🤖 Generated with Claude Code

Backend used OS-native separators when building the file tree, so on
Windows leaf labels showed the full path (`internal\Benchmark\plan.md`)
because the frontend splits on `/`. Also fixes git status lookup which
compared OS-native paths against git's POSIX-format paths.

Closes #677

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for mdts-unhappychoice ready!

Name Link
🔨 Latest commit 65c5610
🔍 Latest deploy log https://app.netlify.com/projects/mdts-unhappychoice/deploys/69fb613170021400088b80cc
😎 Deploy Preview https://deploy-preview-691--mdts-unhappychoice.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 21 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7a31a3b8-90e4-48ea-8a3a-e32a0e0537f5

📥 Commits

Reviewing files that changed from the base of the PR and between ec6d253 and 65c5610.

📒 Files selected for processing (2)
  • src/server/routes/filetree.ts
  • test/unit/server/routes/filetree.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/677-tree-view-filename

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.34%. Comparing base (ec6d253) to head (65c5610).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #691   +/-   ##
=======================================
  Coverage   99.34%   99.34%           
=======================================
  Files          69       69           
  Lines        1534     1537    +3     
  Branches      361      371   +10     
=======================================
+ Hits         1524     1527    +3     
  Misses          9        9           
  Partials        1        1           
Flag Coverage Δ
frontend 99.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@unhappychoice unhappychoice merged commit 8a7bb12 into main May 6, 2026
11 checks passed
@unhappychoice unhappychoice deleted the fix/677-tree-view-filename branch May 6, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Tree view leaf node displays full file path instead of filename

1 participant