Skip to content

Commit 5267f3f

Browse files
ajcvickersclaude
andcommitted
Escape quotes in arguments without spaces in Exe.ToArguments
The no-space fast path appended arguments verbatim, so a literal quote (for example the JSON {"tenant":"blue"} passed through the bundle discovery child process) was dropped by the child's command-line parsing. Take the fast path only when the argument has neither a space nor a quote. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent e568bbe commit 5267f3f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/dotnet-ef/Exe.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static string ToArguments(IReadOnlyList<string> args)
110110
continue;
111111
}
112112

113-
if (args[i].IndexOf(' ') == -1)
113+
if (args[i].IndexOf(' ') == -1 && args[i].IndexOf('"') == -1)
114114
{
115115
builder.Append(args[i]);
116116

‎test/dotnet-ef.Tests/ExeTest.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public void ToArguments_works()
3434
result);
3535
}
3636

37+
[Fact]
38+
public void ToArguments_escapes_quotes_in_arguments_without_spaces()
39+
=> Assert.Equal(
40+
"\"{\\\"tenant\\\":\\\"blue\\\"}\" \"say\\\\\\\"hi\" plain",
41+
ToArguments(["{\"tenant\":\"blue\"}", "say\\\"hi", "plain"]));
42+
3743
[Fact]
3844
public void ToArguments_does_not_escape_UNC_prefix()
3945
=> Assert.Equal(

0 commit comments

Comments
 (0)