fix: normalize path separators for keyword matching on Windows - #1222
Open
avasis-ai wants to merge 2 commits into
Open
fix: normalize path separators for keyword matching on Windows#1222avasis-ai wants to merge 2 commits into
avasis-ai wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Normalizes backslash path separators to forward slashes when matching keywords on Windows, so that queries like
cd bar/meowcorrectly match stored paths like~\foo\bar\meow.On Windows, the database stores paths with backslashes (
\), but users may type queries with forward slashes (/). Thefilter_by_keywordsfunction 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