fix(zsh): detect relative paths through symlinks as directories

When cwd is a symlink, [[ -d ../foo ]] follows the symlink before
resolving .., so the check fails even though cd ../foo would succeed
via the shell's logical path tracking. Allow paths containing ..
through to __zoxide_cd, which relies on the shell's native cd behavior.

Fixes #1166
This commit is contained in:
salarkhannn 2026-06-30 16:55:12 +05:00
parent 84bd26ebe3
commit daa5f384b2
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,7 @@ function __zoxide_z() {
__zoxide_doctor __zoxide_doctor
if [[ "$#" -eq 0 ]]; then if [[ "$#" -eq 0 ]]; then
__zoxide_cd ~ __zoxide_cd ~
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = *..* ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then
__zoxide_cd "$1" __zoxide_cd "$1"
elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then
__zoxide_cd "$2" __zoxide_cd "$2"