-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Escape single quotes while translating dropped Win32 paths #18007
Conversation
@microsoft-github-policy-service agree |
Would it be simpler to paste with double quotes and handle escaping of significant characters like |
@lhecker I would prefer searching for just one character ( The inserting sequence |
Also, escaping just like Old: Additional references: |
bcf2c74
to
9eabd09
Compare
Hey, sorry about this - I didn't realize we had an open PR in this area when I changed how path translation works. You will probably have conflicts or outright failures once you merge |
Checked. The solution seems to be simple and working on it. |
9eabd09
to
dcc31cb
Compare
This comment has been minimized.
This comment has been minimized.
dcc31cb
to
94a0bdd
Compare
Overhauled the PR to adopt my changes over @DHowett's. |
d7b92af
to
e942600
Compare
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, the terminal control does not escape single quotes (allowed in the Win32 subsystem) that need escapes when translated. On the translation styles other than "none" (note: all other translation styles are currently intended for the POSIX shell), it causes incorrect path to be pasted when the path contains one or more single quotes (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again) when the path translation is required.
e942600
to
d2ed3d5
Compare
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.
Thank you so much for this fix, and for your apparently infinite patience. I, and the team, really appreciate it!
@DHowett @lhecker The code is identical to the PR version 2 (that fits 1.21 and 1.22 better than version 4) but incorporates some clarifications from the final merged version (PR version 4). |
Sweet! That saves me a bunch of time as usually I’m doing the backports myself. Thank you :) |
Summary of the Pull Request
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary.
However, the terminal control does not escape single quotes (allowed in the Win32 subsystem) that need escapes when translated.
On the translation styles other than
"none"
(note: all other translation styles are currently intended for the POSIX shell), it causes incorrect path to be pasted when the path contains one or more single quotes (see #18006 for an example).With this commit, the terminal control escapes a single quote with a valid escape sequence
'\''
(finish quote, print a single quote then begin quote again) when the path translation is required.History
v1 → v2
'"'"'
to much shorter'\''
.v2 → v3
v3 → v4 (current)
References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
This is a follow-up of #16214 and #18195, fixing #18006.
Validation Steps Performed
PR Checklist