Skip to content

Commit 9adc32d

Browse files
Escapes ANSI codes in announcements
1 parent 76f2bea commit 9adc32d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dev-proxy/Announcement.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Text.RegularExpressions;
5+
46
namespace Microsoft.DevProxy;
57

68
static class Announcement
@@ -12,6 +14,9 @@ public static async Task ShowAsync()
1214
var announcement = await GetAsync();
1315
if (!string.IsNullOrEmpty(announcement))
1416
{
17+
// Unescape the announcement to remove any escape characters
18+
// in case we're using ANSI escape codes for color formatting
19+
announcement = Regex.Unescape(announcement);
1520
await Console.Error.WriteLineAsync(announcement);
1621
}
1722
}

0 commit comments

Comments
 (0)