diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/sync/message/RichMessageParser.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/sync/message/RichMessageParser.kt index 1506c86..97960b2 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/sync/message/RichMessageParser.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/sync/message/RichMessageParser.kt @@ -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() .dropWhile { it.startsWith("> ") || it.isEmpty() } diff --git a/matrix/services/sync/src/test/kotlin/app/dapk/st/matrix/sync/internal/sync/RichMessageParserTest.kt b/matrix/services/sync/src/test/kotlin/app/dapk/st/matrix/sync/internal/sync/RichMessageParserTest.kt index 69622d4..796dcfd 100644 --- a/matrix/services/sync/src/test/kotlin/app/dapk/st/matrix/sync/internal/sync/RichMessageParserTest.kt +++ b/matrix/services/sync/src/test/kotlin/app/dapk/st/matrix/sync/internal/sync/RichMessageParserTest.kt @@ -36,6 +36,12 @@ class RichMessageParserTest { expected = RichText(listOf(Normal("Hello world! \"foo bar\""))) ) + @Test + fun `replaces ampersand entity`() = runParserTest( + input = "Hello & world!", + expected = RichText(listOf(Normal("Hello & world!"))) + ) + @Test fun `replaces apostrophe entity`() = runParserTest( Case(