diff --git a/src/Aspire.Dashboard/ConsoleLogs/UrlParser.cs b/src/Aspire.Dashboard/ConsoleLogs/UrlParser.cs index 0b19a200ba..02e1d9fd3e 100644 --- a/src/Aspire.Dashboard/ConsoleLogs/UrlParser.cs +++ b/src/Aspire.Dashboard/ConsoleLogs/UrlParser.cs @@ -65,17 +65,9 @@ static void AppendNonMatchFragment(StringBuilder stringBuilder, Funchttp://bing.com/")] [InlineData("http://bing.com/dir", "http://bing.com/dir")] [InlineData("http://bing.com/index.aspx", "http://bing.com/index.aspx")] - [InlineData("http://bing", "http://bing")] + [InlineData("http://localhost", "http://localhost")] public void TryParse_SupportedUrlFormats(string input, string? expectedOutput) { var result = UrlParser.TryParse(input, WebUtility.HtmlEncode, out var modifiedText); @@ -83,4 +83,17 @@ public void GenerateUrlRegEx_MatchUrlAfterContent(string content) var match = regex.Match(content); Assert.Equal("http://www.localhost:8080", match.Value.ToLowerInvariant()); } + + [Theory] + [InlineData("http://www.localhost:8080!", "http://www.localhost:8080!")] + [InlineData("http://www.localhost:8080/path!", "http://www.localhost:8080/path!")] + [InlineData("http://www.localhost:8080/path;", "http://www.localhost:8080/path")] + [InlineData("http://www.localhost:8080;", "http://www.localhost:8080")] + [InlineData("http://www.local;host:8080;", "http://www.local")] + public void GenerateUrlRegEx_MatchUrlBeforeContent(string content, string expected) + { + var regex = UrlParser.GenerateUrlRegEx(); + var match = regex.Match(content); + Assert.Equal(expected, match.Value.ToLowerInvariant()); + } }