SchildiChat / SchildiChat-android

Matrix client / Element Android fork
https://schildi.chat/android/
Apache License 2.0
386 stars 49 forks source link

Double room and user mentions when <a> object text contains another HTML object. #148

Closed 0xDEADCADE closed 1 year ago

0xDEADCADE commented 1 year ago

Describe the bug Sending the following as HTML causes SchildiChat Android to display the room/user mention twice. <a href="https://matrix.to/#/%23android%3Aschildi.chat"><img src="mxc://supercable.onl/fVWStgRAiMCZVnCTOfjCYFnL" height="24"> SchildiChat Android</a>

To Reproduce Steps to reproduce the behavior:

  1. Send an event of type m.room.message with this content:
    {
    "body": "<a href=\"https://matrix.to/#/%23android%3Aschildi.chat\"><img src=\"mxc://supercable.onl/fVWStgRAiMCZVnCTOfjCYFnL\" height=\"24\"> SchildiChat Android</a>",
    "format": "org.matrix.custom.html",
    "formatted_body": "<a href=\"https://matrix.to/#/%23android%3Aschildi.chat\"><img src=\"mxc://supercable.onl/fVWStgRAiMCZVnCTOfjCYFnL\" height=\"24\"> SchildiChat Android</a>",
    "msgtype": "m.text"
    }
  2. See the room mention appear twice, whereas on other clients it appears once

Expected behavior The room mention should appear once

Screenshots Example Screenshot

Smartphone (please complete the following information):

Additional context

Upstream relevance

SpiritCroc commented 1 year ago

Haven't figured out what is happening there yet, but seems to be caused by the combination of the pills processor and the inline image plugin - if one of them is disabled, it looks ok. If the pills processor does nothing, it also looks ok. If the image plugin does a minimum of loading no image, it still breaks.

SpiritCroc commented 1 year ago

No more pills for nested inline images to fix this case, to be included in the next release.