From 1bfc2fd67088395ed7f7d4e917ffe7e893f5ead5 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Tue, 1 Nov 2022 10:37:31 +0000 Subject: [PATCH] handle apos; html entity --- .../sync/internal/sync/message/RichMessageParser.kt | 2 +- .../matrix/sync/internal/sync/RichMessageParserTest.kt | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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 cb26b5b..1506c86 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("'", "'") +private fun String.removeHtmlEntities() = this.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 e910a07..69622d4 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 @@ -38,8 +38,14 @@ class RichMessageParserTest { @Test fun `replaces apostrophe entity`() = runParserTest( - input = "Hello world! foo's bar", - expected = RichText(listOf(Normal("Hello world! foo's bar"))) + Case( + input = "Hello world! foo's bar", + expected = RichText(listOf(Normal("Hello world! foo's bar"))) + ), + Case( + input = "Hello world! foo's bar", + expected = RichText(listOf(Normal("Hello world! foo's bar"))) + ), ) @Test