Skip to content

Adjusted support for windows path normalization#132

Open
zdeneksrejber wants to merge 5 commits into
TALXIS:masterfrom
zdeneksrejber:users/zdenek.srejber/windows.support
Open

Adjusted support for windows path normalization#132
zdeneksrejber wants to merge 5 commits into
TALXIS:masterfrom
zdeneksrejber:users/zdenek.srejber/windows.support

Conversation

@zdeneksrejber
Copy link
Copy Markdown
Member

@zdeneksrejber zdeneksrejber commented May 27, 2026

  • Fix Windows file URI path normalization for MCP paths
  • Normalize /c:/... Uri.LocalPath inputs before home expansion
  • Preserve drive-qualified paths containing ~ as normal filesystem paths
  • Add tests for VS Code lowercase drive URIs and duplicate-drive regressions

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Windows-specific bug in MCP path normalization where file URI local paths like /c:/Users/project (as returned by Uri.LocalPath for VS Code's lowercase-drive roots) were being passed straight to Path.GetFullPath, producing duplicated-drive results like C:\c:\Users\project. The fix strips the leading / for /<letter>:/... inputs on Windows before any home-expansion logic runs, and treats drive-qualified ~ segments (e.g. C:\~\Sources\project) as literal filesystem paths rather than home-relative.

Changes:

  • Add TryNormalizeWindowsFileUriDrivePath to strip the leading slash from /<drive>:/... early in ExpandHomeRelativePath on Windows.
  • Add tests covering VS Code lowercase-drive URIs, the duplicate-drive regression, and drive-qualified ~ paths in both RootsServiceTests and McpPathNormalizerTests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/TALXIS.CLI.MCP/McpPathNormalizer.cs Adds early Windows file-URI drive-path normalization to drop the leading /.
tests/TALXIS.CLI.Tests/MCP/RootsServiceTests.cs Adds regression tests for lowercase-drive URIs and drive-qualified ~ handling.
tests/TALXIS.CLI.Tests/MCP/McpPathNormalizerTests.cs Adds tests for drive-qualified tilde paths and file-URI drive-path leading-slash normalization.

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.

2 participants