From a49b065ee28bf146d09afcbffbde9820034c1266 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 27 Aug 2023 16:50:33 +0100 Subject: [PATCH] fix: fix support for Discord timestamps --- VPLink.Common/MentionUtility.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/VPLink.Common/MentionUtility.cs b/VPLink.Common/MentionUtility.cs index ebe9963..5bc355d 100644 --- a/VPLink.Common/MentionUtility.cs +++ b/VPLink.Common/MentionUtility.cs @@ -78,9 +78,15 @@ public static class MentionUtility using Utf8ValueStringBuilder buffer = ZString.CreateUtf8StringBuilder(); var formatSpecifier = '\0'; var isEscaped = false; + var breakLoop = false; for (var index = 2; index < contents.Length; index++) { + if (breakLoop) + { + break; + } + char current = contents[index]; switch (current) { @@ -90,6 +96,8 @@ public static class MentionUtility case ':' when !isEscaped && index + 1 < contents.Length: formatSpecifier = contents[index + 1]; + if (formatSpecifier == '>') formatSpecifier = '\0'; // ignore closing tag + breakLoop = true; break; case '>' when !isEscaped: