-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Powershell] zoxide Does Not Escape Paths #312
Comments
Adds escapes to paths used in Set-Location calls so they work as expected even with special characters.
Adds escapes to paths used in Set-Location calls so they work as expected even with special characters.
I fixed this by adjusting my profile to override the function cd {
z @args
}
Invoke-Expression (& { (zoxide init powershell | Out-String) })
function global:__zoxide_cd($dir, $literal) {
# we need to override this so it doesn't pass -LiteralPath
# https://github.com/ajeetdsouza/zoxide/blob/d99d82f141106c5c9e32fe75ec7695a43b3fcadc/templates/powershell.txt#L29C1-L46C2
$dir = Set-Location $dir -Passthru -ErrorAction Stop
} Without overriding the function, I got
Looks like it from here at least is always passed zoxide/templates/powershell.txt Lines 102 to 124 in d99d82f
|
What is the actual name of your directory? |
the problem reproduced for me using a dir named |
Problem
Powershell requires escaping special characters even if they're enclosed in single quotes. So calling
Set-Location
on, say'D:\test\[foo] bar\'
will fail like:Solution
Path passed to Set-Location should be escaped:
The text was updated successfully, but these errors were encountered: