Skip to content

feature: improve normalization logic for files to help synchronization logic#31

Open
sytone wants to merge 1 commit intovrtmrz:mainfrom
sytone:feat-fixwindowspathissues
Open

feature: improve normalization logic for files to help synchronization logic#31
sytone wants to merge 1 commit intovrtmrz:mainfrom
sytone:feat-fixwindowspathissues

Conversation

@sytone
Copy link

@sytone sytone commented Oct 10, 2025

  • Implemented normalization of file paths in Peer classes to prevent additional loops.
  • Introduced useNormalizedCachePaths configuration option across peers to ensure consistent cache lookups.
  • Enhanced README with detailed configuration options and explanations for new features.
  • Updated Deno imports for compatibility and improved path handling.

This fixes #29

On Windows, the synchronization was causing additional loops due to inconsistent path separators in cache keys causing updates to be pushed to peers that should have been skipped.

Root Cause

On Windows:

  • File watcher events from Deno provide paths with backslashes (\)
  • Paths processed through toPosixPath() have forward slashes (/)
  • The normalizeCacheKey() method wasn't normalizing separators
  • Different code paths produced different separator styles for the same file
  • BaseDir may have backslashes (\) or forward slashes (/) so that is also normalized.

This ensures that:

  • "./vault/file.md" becomes "file.md"
  • "vault\file.md" becomes "file.md" (Windows)
  • "vault/file.md" becomes "file.md"
  • baseDir is properly stripped regardless of format

…n logic

- Implemented normalization of file paths in Peer classes to prevent additional loops.
- Introduced useNormalizedCachePaths configuration option across peers to ensure consistent cache lookups.
- Enhanced README with detailed configuration options and explanations for new features.
- Updated Deno imports for compatibility and improved path handling.
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.

Additional sync messages being sent on Windows due to path comparision issues.

1 participant

Comments