Repository: thunderbird/thunderbird-android (language: kotlin)

Issue:
Render in HTML <tt> with monospaced font
### Checklist

- [X] I have used the search function to see if someone else has already submitted the same bug report.
- [X] I will describe the problem with as much detail as possible.

### App version

6.202

### Where did you get the app from?

F-Droid

### Android version

12

### Device model

_No response_

### Steps to reproduce

I (send and) receive an email containing:
```
--example.org=_3175999=_1666532806=_1948217805_A
Content-Type: text/html; charset=utf-8
Content-Disposition: inline

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title></title></head><body>
<b>You have received an updated invitation from <a href="mailto:abc@example.org">A B C</a></b><p>
<table border cellpadding=5>
<tr><td><b>Summary</b></td><td>Hokus Pokus</td></tr>
<tr><td><b>Location</b></td><td>somewhereL2</td></tr>
<tr><td><b>Start</b></td><td><tt>Thu,&nbsp;27&nbsp;Oct&nbsp;2022&nbsp;07:00&nbsp;UTC<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:00&nbsp;Europe/Sofia&nbsp;</tt></td></tr>
<tr><td><b>Attendees</b></td><td>&#8226; <a href="mailto:gggg@example.int">Ombre</a>
  <br>&#8226; <a href="mailto:1@mail.aegee.org">fff@example.be</a></td></tr>
<tr><td><b>Description</b></td><td>Long text, no meaning.</td></tr>
</table></body></html>
```

### Expected behavior

I expect that the text bewenn `<tt>` and `</tt>` is rendered with monospaced font.

### Actual behavior

No monospaced font, the lower line is aligned to the upper line

### Logs

_No response_


Discussion hints:
nan

Pull request: Keep `<tt>` tags when sanitizing HTML
Fixes #6423

Test command: ./gradlew :app:html-cleaner:test --tests "app.k9mail.html.cleaner.HtmlSanitizerTest"

Fix patch:
diff --git a/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/BodyCleaner.kt b/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/BodyCleaner.kt
index 3bc44effdc7..43a6d827385 100644
--- a/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/BodyCleaner.kt
+++ b/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/BodyCleaner.kt
@@ -13,7 +13,7 @@ internal class BodyCleaner {
 
     init {
         val allowList = Safelist.relaxed()
-            .addTags("font", "hr", "ins", "del", "center", "map", "area", "title")
+            .addTags("font", "hr", "ins", "del", "center", "map", "area", "title", "tt", "kbd", "samp", "var")
             .addAttributes("font", "color", "face", "size")
             .addAttributes("a", "name")
             .addAttributes("div", "align")


Test patch:
diff --git a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt
index 8720a3273d5..d60ae8b3812 100644
--- a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt
+++ b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt
@@ -445,6 +445,43 @@ class HtmlSanitizerTest {
         )
     }
 
+    @Test
+    fun `should keep 'tt' element`() {
+        assertTagsNotStripped("tt")
+    }
+
+    @Test
+    fun `should keep 'kbd' element`() {
+        assertTagsNotStripped("kbd")
+    }
+
+    @Test
+    fun `should keep 'samp' element`() {
+        assertTagsNotStripped("samp")
+    }
+
+    @Test
+    fun `should keep 'var' element`() {
+        assertTagsNotStripped("var")
+    }
+
+    private fun assertTagsNotStripped(element: String) {
+        val html = """<$element>some text</$element>"""
+
+        val result = htmlSanitizer.sanitize(html)
+
+        assertThat(result.toCompactString()).isEqualTo(
+            """
+            <html>
+            <head></head>
+            <body>
+            <$element>some text</$element>
+            </body>
+            </html>
+            """.trimIndent().trimLineBreaks()
+        )
+    }
+
     private fun Document.toCompactString(): String {
         outputSettings()
             .prettyPrint(false)