Skip to content

Commit 37d5759

Browse files
authored
Add quotation marks in dashboard around arguments with spaces in them (#10404)
* Add quotation marks in dashboard around arguments with spaces in them * add FormatValue method
1 parent 94ab77b commit 37d5759

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

playground/Stress/Stress.AppHost/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126
builder.AddProject<Projects.Aspire_Dashboard>(KnownResourceNames.AspireDashboard);
127127
#endif
128128

129+
builder.AddExecutable("executableWithSingleArg", "dotnet", Environment.CurrentDirectory, "--version");
130+
builder.AddExecutable("executableWithSingleEscapedArg", "dotnet", Environment.CurrentDirectory, "one two");
131+
builder.AddExecutable("executableWithMultipleArgs", "dotnet", Environment.CurrentDirectory, "--version", "one two");
132+
129133
IResourceBuilder<IResource>? previousResourceBuilder = null;
130134

131135
for (var i = 0; i < 3; i++)

src/Aspire.Dashboard/Components/ResourcesGridColumns/SourceColumnDisplay.razor

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
@using Aspire.Dashboard.Model
2-
@using Aspire.Dashboard.Resources
1+
@using Aspire.Dashboard.Resources
32
@using Aspire.Dashboard.Utils
43

54
@inject IStringLocalizer<Columns> Loc
@@ -21,7 +20,12 @@
2120
{
2221
if (launchArgument.IsShown)
2322
{
24-
<span class="subtext">&nbsp;@launchArgument.Value</span>
23+
<span class="subtext">@FormatValue(launchArgument.Value)</span>
24+
25+
static string FormatValue(string value)
26+
{
27+
return " " + (value.Contains(' ') ? $"\"{value}\"" : value);
28+
}
2529
}
2630
else
2731
{

0 commit comments

Comments
 (0)