Skip to content

Conversation

@vanmarkic
Copy link

Summary

  • Fixes issue where symlink resolution caused duplicate path segments
  • Adds function to detect and remove duplicate consecutive path segments
  • Includes comprehensive test coverage

Changes

  • Implemented removeDuplicatePathSegments function to clean resolved paths
  • Added 114 lines of tests covering various duplicate path scenarios
  • Preserves leading slashes while removing internal duplicates

Related Issue

Fixes bug #36

🤖 Generated with Claude Code

…amdev#36)

The MCP server installation was creating paths with duplicate segments (e.g., /home/user/home/user/vault) when resolving symlinks. This occurred because the symlink resolution process would replace the entire path with the resolved path, potentially including duplicate segments.

This fix adds a removeDuplicatePathSegments function that:
- Detects and removes consecutive duplicate path segment sequences
- Works with both POSIX and Windows paths
- Handles complex cases like /home/user/home/user/vault -> /home/user/vault

The function is applied after all symlink resolution to ensure paths are normalized correctly.

Fixes jacksteamdev#36
…ksteamdev#36)

- Test simple duplicate removal (/home/user/home/user -> /home/user)
- Test multiple consecutive duplicates
- Test complex duplicate patterns
- Test preservation of non-duplicate paths
- Test Windows-style paths with duplicates
- Test iCloud Drive duplicate paths
- Test root directory handling
- Test paths with similar but non-duplicate segments
…dev#36)

- Fix bug where path.join() with empty first element drops leading slash
- Handle special case for root directory (/)
- Handle empty normalized arrays
- Update test function to match implementation
- All tests now pass
@netlify
Copy link

netlify bot commented Nov 15, 2025

Deploy Preview for superb-starlight-b5acb5 canceled.

Name Link
🔨 Latest commit b772682
🔍 Latest deploy log https://app.netlify.com/projects/superb-starlight-b5acb5/deploys/6918c1a81f644a000870b9c4

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