Skip to content

Commit

Permalink
Azure.Provisioning: Avoid excess nulls in BicepStringBuilder (#46742)
Browse files Browse the repository at this point in the history
  • Loading branch information
tg-msft authored Oct 22, 2024
1 parent 2deb63c commit 8897cd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ await test.Define(
infra.Add(new ProvisioningOutput("blobs_endpoint", typeof(string)) { Value = storage.PrimaryEndpoints.Value!.BlobUri });

// Manually compute the public Azure endpoint
string? nothing = null;
BicepValue<string> computed =
new BicepStringBuilder()
.Append("https://")
.Append($"{storage.Name}")
.Append(".blob.core.windows.net");
.Append($".blob.core.windows.net{nothing}");
infra.Add(new ProvisioningOutput("computed_endpoint", typeof(string)) { Value = computed });

return infra;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ public void AppendFormatted<T>(T t)
}
else
{
_expressions.Add(
t is null ?
BicepSyntax.Null() :
BicepSyntax.Value(t.ToString() ?? ""));
string? s = t?.ToString();
if (s is not null)
{
_expressions.Add(BicepSyntax.Value(s));
}
}
}

Expand Down

0 comments on commit 8897cd4

Please sign in to comment.