Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update
  • Loading branch information
JamesNK committed Oct 23, 2024
commit 36f10b19a28f7b3013940e02c3785da1a3478e11
27 changes: 0 additions & 27 deletions src/Aspire.Dashboard/ConsoleLogs/LogLevelParser.cs

This file was deleted.

13 changes: 6 additions & 7 deletions src/Aspire.Dashboard/ConsoleLogs/UrlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,17 @@ static void AppendNonMatchFragment(StringBuilder stringBuilder, Func<string, str
}

// Regular expression that detects http/https URLs in a log entry
// Based on the RegEx used in Windows Terminal for the same purpose, but limited
// to only http/https URLs
// Based on the RegEx used in Windows Terminal for the same purpose. Some modifications:
// - Can start at a non word boundary. This behavior is similar to how GitHub matches URLs in pretty printed code.
// - Limited to only http/https URLs.
// - Ignore case. That means it matches URLs starting with http and HTTP.
//
// Explanation:
// (?<=m|\\b) - Match must start at a word boundary (after whitespace or at the start of the text) or "m".
// "m" is a trailing character of ANSI escape sequences.
// Required because URLs are matched before processing ANSI escape sequences.
// https?:// - http:// or https://
// [-A-Za-z0-9+&@#/%?=~_|$!:,.;]* - Any character in the list, matched zero or more times.
// [A-Za-z0-9+&@#/%=~_|$] - Any character in the list, matched exactly once
[GeneratedRegex(
"(?<=m|\\b)https?://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$]",
RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)]
"https?://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$]",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)]
public static partial Regex GenerateUrlRegEx();
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,11 @@ public void TryParse_ExcludeInvalidTrailingChars(string input, string? expectedO
Assert.Equal(expectedOutput, modifiedText);
}

// thequickhttp://localhost:80brownfox
// thequickhttp://localhost:80 brownfox
// thequickhttp://localhost:80#brownfox
// mhttp://localhost:80#brownfox
// httphttp://localhost:80#brownfox
// http://WWW.localhost:80#brownfox
// HTTP://www.localhost:80#brownfox
[Theory]
[InlineData("http://www.localhost:8080")]
[InlineData("HTTP://WWW.LOCALHOST:8080")]
[InlineData("mhttp://www.localhost:8080")]
[InlineData("httphttp://www.localhost:8080")]
[InlineData(" http://www.localhost:8080")]
public void GenerateUrlRegEx_MatchUrlAfterContent(string content)
{
Expand Down
Loading