element-hq / element-hq/element-android

Wrong rendering of `<pre>` formatted body

Open
#4,633 0 comments 0 reactions 0 assignees View on GitHub
A-Composer A-Timeline O-Uncommon S-Minor T-Defect Z-parity-with-web
Dominant language
Kotlin
Stars
3.7k
Forks
917
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

I have a bot that send those two messages following each others (I obfuscated the names):
```
"content": {
"body": " 1111111111222222\n 1234567890123456789012345\n 1) 122 ××××× e‌r‌d‌n‌a‌x‌e‌l‌i\n 2) 102 ××××× Xxxxxx\n 3) 99 ×××× Xxxxxx Xxxxx\n 4) 97 ××××× xxxxxx\n 5) 91 ××××× XxxxxxXxxxxxx\n 6) 81 ××××× xxxxxxx\n 7) 54 ××× xxxxxx\n 8) 37 + ×× xxxxx",
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "

                 1111111111222222\n        1234567890123456789012345\n 1) 122 ×××××                     e‌r‌d‌n‌a‌x‌e‌l‌i\n 2) 102 ×××××                     Xxxxxx\n 3)  99 ××××                      Xxxxxx Xxxx\n 4)  97 ×××××                     xxxxxx\n 5)  91 ×××××                     XxxxxxXxxxxxx\n 6)  81 ×××××                     xxxxxxx\n 7)  54 ×××                       xxxxxx\n 8)  37 + ××                      xxxxx
"
},
```
```
"content": {
"body": " 9) 29 ××× Xxxxxxx Xxxxxxx\n10) 28 ×× xxxxxxxx\n11) 15 ×× xxXxxxxXxXxxXxx\n12) 0 Xxxxxx\n13) 0 Xxxxxxxxx",
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "
 9)  29 ×××                       Xxxxxxx Xxxxxxx\n10)  28 ××                        xxxxxxx\n11)  15 ××                        xxXxxxxXxXxxXxx\n12)   0                           Xxxxxx\n13)   0                           Xxxxxxxxx
"
},
```

### Outcome

#### What did you expect?

I expect the rendering to be the same as in element web:
![2021-12-06-091843_664x434_scrot](https://user-images.githubusercontent.com/479441/144813973-a58bbbc1-7876-4622-9409-07c89dc45510.png)

#### What happened instead?

But it is wrong:
![Screenshot_20211206-092036](https://user-images.githubusercontent.com/479441/144814008-8973ec17-0053-430d-98be-8f3330d00fc1.jpeg)

It seems like the first message is interpreted as markdown? And the second one does not even have a monospace font, and I don't know what happens with the header.

### Your phone model

Moto G5 Plus

### Operating system version

Android 8.1.0

### Application version and app store

Element 1.3.7 from playstore

### Homeserver

cervoi.se

### Will you send logs?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.