You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#188 introduced Powershell and a new method for encoding arguments. By wrapping the target in, "double quote with double quotes to ensure the inner quotes are passed through", paths with forward slashes on Windows no longer get reinterpreted as they did before, causing open to fail.
I believe this to also be the cause of sindresorhus/open-cli#16 as open-cli@6.0.1 works on Windows with a target path like dist\report.html but not with dist/report.html, unlike earlier versions which worked with both.
Currently, target has slashes and backticks added to it before encoding:
Of course, this isn't a proper solution, because I'm sure those quotes and ticks are being inserted for a purpose, but this hopefully demonstrates the issue for someone else with a better understanding of Powershell.
The text was updated successfully, but these errors were encountered:
// With escaped quotation character
Start "`"Path\filename.ext`"" // OK
Start "`"Path/filename.ext`"" // Error
Start "`"Path with spaces\filename.ext`"" // OK
Start "`"Path with spaces/filename.ext`"" // Error
// Without escaped quotation character
Start "Path\filename.ext" // OK
Start "Path/filename.ext" // OK
Start "Path with spaces\filename.ext" // OK
Start "Path with spaces/filename.ext" // OK
As you can see, if we add an escaped " character and use / as a separator in the path we will get an error.
The fact is that when passing the path of a filename/link with spaces for opening, we do not need to additionally add a " character as it is now done in the string.
Therefore, the fix for this bug will be simple - need to remove the addition of escaped quotation marks for the target.
I made a micro PR for that - #220.
#188 introduced Powershell and a new method for encoding arguments. By wrapping the target in, "double quote with double quotes to ensure the inner quotes are passed through", paths with forward slashes on Windows no longer get reinterpreted as they did before, causing
open
to fail.I believe this to also be the cause of sindresorhus/open-cli#16 as
open-cli@6.0.1
works on Windows with a target path likedist\report.html
but not withdist/report.html
, unlike earlier versions which worked with both.Currently,
target
has slashes and backticks added to it before encoding:... which doesn't actually result in the file being opened. If instead the target is passed as-is:
...then
open
works as expected.Of course, this isn't a proper solution, because I'm sure those quotes and ticks are being inserted for a purpose, but this hopefully demonstrates the issue for someone else with a better understanding of Powershell.
The text was updated successfully, but these errors were encountered: