mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix passing escaped double quoted spaces to native executables
This commit is contained in:
@@ -4,6 +4,8 @@ Changelog
|
||||
Unreleased
|
||||
----------
|
||||
|
||||
- Fix passing escaped double quoted spaces to native executables
|
||||
|
||||
v6.0.0-alpha.9 - 2016-08-15
|
||||
---------------------------
|
||||
|
||||
|
||||
@@ -194,11 +194,11 @@ namespace System.Management.Automation
|
||||
// just the normal double quotes, no other special quotes. Also note that mismatched
|
||||
// quotes are supported.
|
||||
|
||||
bool needQuotes = false;
|
||||
bool needQuotes = false, followingBackslash = false;
|
||||
int quoteCount = 0;
|
||||
for (int i = 0; i < arg.Length; i++)
|
||||
{
|
||||
if (arg[i] == '"')
|
||||
if (arg[i] == '"' && !followingBackslash)
|
||||
{
|
||||
quoteCount += 1;
|
||||
}
|
||||
@@ -206,6 +206,8 @@ namespace System.Management.Automation
|
||||
{
|
||||
needQuotes = true;
|
||||
}
|
||||
|
||||
followingBackslash = arg[i] == '\\';
|
||||
}
|
||||
|
||||
if (needQuotes)
|
||||
|
||||
Reference in New Issue
Block a user