mautrix / signal

A Matrix-Signal puppeting bridge
GNU Affero General Public License v3.0
484 stars 74 forks source link

bridge dropping newlines and causing message duplication when replying to yourself #508

Closed htayj closed 2 months ago

htayj commented 2 months ago

when replying to your own multi-line message with a multi-line message, and occasionally when replying to someone who has just replied to you, the last message that you sent in the chain is sometimes appended to the front of your latest message.

this may be related to line endings, because it does not seem to happen when sending the message from element itself, although element supports displaying the messages correctly. Messages from the client I am using (ement) also drop all newlines from the perspective of signal when replying, although those same newlines display correctly in element.

1714694716 1714694729

Here is the duplicated reply from the element json export

    {
      "type": "m.room.message",
      "sender": "@tay:vexillomancy.org",
      "content": {
        "body": "> <taylor> > <Ian (Signal)> I don't think that I can.\n\nOh wait yes I can\n\ntest 2 with multi line\n\nbottom text\n\nalso didnt work \n\nnot sure why",
        "format": "org.matrix.custom.html",
        "formatted_body": "<mx-reply>\n  <blockquote>\n    <a href=\"https://matrix.to/#/!cHfcsdLfMDgLDNPYFq:vexillomancy.org/$PQPUIwYOHjttRTPCMbCyJ3YIpBmqT0PueKKDOYQMtwM\">In reply to</a>\n    <a href=\"https://matrix.to/#/@tay:vexillomancy.org\">taylor</a>\n    <br />\n    <mx-reply>\n  <blockquote>\n    <a href=\"https://matrix.to/#/!cHfcsdLfMDgLDNPYFq:vexillomancy.org/$iPkKg0AgrIgBtbzuoHH1E6H-v9aZW4UlWTm_ckALwfA\">In reply to</a>\n    <a href=\"https://matrix.to/#/@signal_623f852b-8b9c-4465-9579-59ebf2cd1335:vexillomancy.org\">Ian (Signal)</a>\n    <br />\n    I don't think that I can.\n\nOh wait yes I can\n  </blockquote>\n</mx-reply>\ntest 2 with multi line\n\nbottom text\n  </blockquote>\n</mx-reply>\nalso didnt work \n\nnot sure why",
        "m.relates_to": {
          "m.in_reply_to": {
            "event_id": "$PQPUIwYOHjttRTPCMbCyJ3YIpBmqT0PueKKDOYQMtwM"
          }
        },
        "msgtype": "m.text"
      },

version is v0.6.0 (Apr 16 2024, 11:22:12). 1714695503

may be related to https://github.com/mautrix/signal/issues/238 since it seems to happen when this attachment error is present

tulir commented 2 months ago

Looks like a client bug, the formatted_body doesn't have any valid newlines