Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix: plain text messages should not have html formatting #686

Closed
jrick opened this issue Jan 9, 2019 · 5 comments
Closed

matrix: plain text messages should not have html formatting #686

jrick opened this issue Jan 9, 2019 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@jrick
Copy link

jrick commented Jan 9, 2019

The formatted_body field of a matrix message should only be present when the message contains formatting that can not be expressed by the plain text body field. However, this field is now being populated for every single matrix message being created.

example message

example source:

{
  "content": {
    "body": "[slack/dhill] testing bob",
    "format": "org.matrix.custom.html",
    "formatted_body": "[slack/dhill] <p>testing bob</p>\n",
    "msgtype": "m.text"
  },
  "event_id": "$154707001512568ilRFq:decred.org",
  "origin_server_ts": 1547070015547,
  "sender": "@bridge:decred.org",
  "type": "m.room.message",
  "unsigned": {
    "age": 504
  },
  "room_id": "!VFRvyndKpzcLrVslQD:decred.org"
}

I would expect the formatted body to only be present if the message contained formatting such as bold, italics, lists (numbered or bullet), etc.

@42wim
Copy link
Owner

42wim commented Jan 9, 2019

What's the issue with having it for every message ? Is there any impact ?

@jrick
Copy link
Author

jrick commented Jan 9, 2019

It's an optimization, it doesn't violate the spec or break clients, but it's common for clients to perform this operation to reduce the overall message size.

@42wim
Copy link
Owner

42wim commented Jan 9, 2019

I understand, but if it doesn't cause any issues, it's low on my priority list.
I'll accept a PR for this though if anyone wants to optimize this.

@42wim 42wim modified the milestones: 2.0.0, low priority Jan 9, 2019
@42wim 42wim added the enhancement New feature or request label Jan 9, 2019
@groug
Copy link

groug commented Feb 27, 2019

Hi,

I'm detecting the same thing, but it's more of a problem for me:
The use of the < p > tag makes a new line between RemoteNickFormat and the body.
Contrary to the other bridges, a 1-line message bridged to matrix creates a 2-lines message (but a 1-line message from matrix creates a 1-line message to other bridges).

FYI, I'm using riot (web and mobile client) for the matrix bridge.

NB: I'm only using matrix and xmpp bridges, when I say "other bridges", I can only talk about xmpp, I'm assuming this is the case for all bridges from the screenshots (even though the screenshot about matrix/riot doesn't show this space between the RemoteNickFormat and the rest of the body).

Apart from that, thanks for this great work, with docker, it took me less than 10 min to connect xmpp and matrix :)

42wim added a commit that referenced this issue Mar 2, 2019
@42wim 42wim modified the milestones: low priority, 1.14.0 Mar 2, 2019
@42wim
Copy link
Owner

42wim commented Mar 2, 2019

@42wim 42wim closed this as completed in e955a05 Mar 2, 2019
zeridon pushed a commit to zeridon/matterbridge that referenced this issue Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants