Also fix MessageFormatter tests

This commit is contained in:
Dan Balasescu
2022-01-11 17:53:15 +09:00
parent 3cb5f43f77
commit ef66ec4622
2 changed files with 31 additions and 13 deletions

View File

@ -57,6 +57,7 @@ namespace osu.Game.Online.Chat
/// </summary>
public static string WebsiteRootUrl
{
get => websiteRootUrl;
set => websiteRootUrl = value
.Trim('/') // trim potential trailing slash/
.Split('/').Last(); // only keep domain name, ignoring protocol.
@ -134,7 +135,7 @@ namespace osu.Game.Online.Chat
case "http":
case "https":
// length > 3 since all these links need another argument to work
if (args.Length > 3 && args[1].EndsWith(websiteRootUrl, StringComparison.OrdinalIgnoreCase))
if (args.Length > 3 && args[1].EndsWith(WebsiteRootUrl, StringComparison.OrdinalIgnoreCase))
{
string mainArg = args[3];
@ -262,7 +263,7 @@ namespace osu.Game.Online.Chat
handleMatches(old_link_regex, "{1}", "{2}", result, startIndex, escapeChars: new[] { '(', ')' });
// handle wiki links
handleMatches(wiki_regex, "{1}", $"https://{websiteRootUrl}/wiki/{{1}}", result, startIndex);
handleMatches(wiki_regex, "{1}", $"https://{WebsiteRootUrl}/wiki/{{1}}", result, startIndex);
// handle bare links
handleAdvanced(advanced_link_regex, result, startIndex);