-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Fix cannot open url contains |
on windows
#98
Conversation
Can you link to some documentation about this? |
Oh, I found https://ss64.com/nt/syntax-esc.html, look at the Escape Character section.
|
@sindresorhus Do you want me replace all those characters?
|
What do you think about #74 (comment) ? If it works, it would be better. |
OK, I‘d like to work on it. |
See sindresorhus#74 comments.
@sindresorhus I add many test results in #74 (comment). I think these test cases is useful to position the issue #74. |
@baoti Still interested in handling #98 (comment)? |
@sindresorhus As #74 (comment) said, wrapping it in double quotes doesn't help. What do you want handling? |
I think @baoti's approach mentioned here would be the best way forward. What an annoying quirk! |
Alright, let's try out this then:
|
@@ -33,7 +33,9 @@ module.exports = (target, opts) => { | |||
} else if (process.platform === 'win32' || isWsl) { | |||
cmd = 'cmd' + (isWsl ? '.exe' : ''); | |||
args.push('/c', 'start', '""', '/b'); | |||
target = target.replace(/&/g, '^&'); | |||
if (target.indexOf(' ') === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (target.indexOf(' ') === -1) { | |
if (!target.includes(' ')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also link to #74 (comment) in a code comment to clarify what it does and why.
@baoti Can you fix the merge conflict? |
@sindresorhus I got the reason for doing not escape which contains space char. The argument would be wrapped in double quotes. See source for detail. We can pass |
Good find. Let’s do that then. |
&
\
<
>
^
|
Detail in #74 (comment).