replacing & html entity with &

This commit is contained in:
Adam Brown 2022-11-03 17:17:21 +00:00
parent c6a6dd9bd3
commit 718fb681c3
2 changed files with 7 additions and 1 deletions

View File

@ -56,7 +56,7 @@ class RichMessageParser {
} }
private fun String.removeHtmlEntities() = this.replace(""", "\"").replace("'", "'").replace("'", "'") private fun String.removeHtmlEntities() = this.replace(""", "\"").replace("'", "'").replace("'", "'").replace("&", "&")
private fun String.dropTextFallback() = this.lines() private fun String.dropTextFallback() = this.lines()
.dropWhile { it.startsWith("> ") || it.isEmpty() } .dropWhile { it.startsWith("> ") || it.isEmpty() }

View File

@ -36,6 +36,12 @@ class RichMessageParserTest {
expected = RichText(listOf(Normal("Hello world! \"foo bar\""))) expected = RichText(listOf(Normal("Hello world! \"foo bar\"")))
) )
@Test
fun `replaces ampersand entity`() = runParserTest(
input = "Hello & world!",
expected = RichText(listOf(Normal("Hello & world!")))
)
@Test @Test
fun `replaces apostrophe entity`() = runParserTest( fun `replaces apostrophe entity`() = runParserTest(
Case( Case(