Skip to content

fix: normalize path separators for keyword matching on Windows - #1222

Open
avasis-ai wants to merge 2 commits into
ajeetdsouza:mainfrom
avasis-ai:fix-forward-slash-windows
Open

fix: normalize path separators for keyword matching on Windows#1222
avasis-ai wants to merge 2 commits into
ajeetdsouza:mainfrom
avasis-ai:fix-forward-slash-windows

Conversation

@avasis-ai

Copy link
Copy Markdown

Summary

Normalizes backslash path separators to forward slashes when matching keywords on Windows, so that queries like cd bar/meow correctly match stored paths like ~\foo\bar\meow.

On Windows, the database stores paths with backslashes (\), but users may type queries with forward slashes (/). The filter_by_keywords function now converts backslashes to forward slashes before matching, ensuring both separator styles work.

Added test cases for Windows-style path matching with forward-slash queries.

Closes #1217

zad111ak-ai pushed a commit to zad111ak-ai/zoxide that referenced this pull request Jul 14, 2026
Normalize both stored paths and query keywords to use forward slashes
before matching in filter_by_keywords. This ensures that on Windows:
- cd bar/meow matches ~\foo\bar\meow
- cd bar\meow matches ~/foo/bar/meow

Unlike PR ajeetdsouza#1222 which only normalizes the path, this normalizes both
sides of the match. Normalization is unconditional (harmless no-op on
Linux/macOS) enabling cross-platform test execution.

Added 7 new test cases for backslash path matching.

Closes ajeetdsouza#1217
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.

Match forward slashes on Windows

2 participants