Images containing "body"/image caption on Matrix should use alt text on Discord #23

Closed
opened 2023-12-20 15:33:10 +00:00 by Ampflower · 1 comment

Image messages containing a body field with a filename field will set the body as the filename rather than the alt text.

How to Reproduce:

  1. Use a client that lets you add a caption/message along side the image
    • Neochat is one such client
  2. Upload an image with a caption.
  3. Note that on the Discord side, the file name itself is set to the provided caption

Possible fix:

  • Use or omit the body provided as the alt text if filename is present.
  • It's notable that Schildi's solution was to add it after the image, although given it is the odd one out (the other two being Element and Neochat), it might not be appropriate to put the message body as the Discord message body when bridging.

Things to note:

  • The client may duplicate the filename in the body, or simply never provide one of either.

Sample from Neochat:

Some identifiable info redacted

{
  "content": {
    "body": "Hi I broke the bridge :3 ",
    "filename": "2023-12-20-08-13-39.png",
    "info": {
      "h": 245,
      "mimetype": "image/png",
      "size": 36003,
      "w": 502
    },
    "msgtype": "m.image",
    "url": "mxc://example.org/aaa"
  },
  "origin_server_ts": -1,
  "sender": "@---",
  "type": "m.room.message",
  "unsigned": {
    "age": -1
  },
  "event_id": "$---",
  "room_id": "!---"
}
Image messages containing a `body` field with a `filename` field will set the body as the filename rather than the alt text. ### How to Reproduce: 1. Use a client that lets you add a caption/message along side the image - Neochat is one such client 2. Upload an image with a caption. 3. Note that on the Discord side, the file name itself is set to the provided caption ### Possible fix: - Use or omit the `body` provided as the alt text if `filename` is present. - It's notable that Schildi's solution was to add it after the image, although given it is the odd one out (the other two being Element and Neochat), it might not be appropriate to put the message body as the Discord message body when bridging. ### Things to note: - The client may duplicate the filename in the body, or simply never provide one of either. ### Sample from Neochat: *Some identifiable info redacted* ```json { "content": { "body": "Hi I broke the bridge :3 ", "filename": "2023-12-20-08-13-39.png", "info": { "h": 245, "mimetype": "image/png", "size": 36003, "w": 502 }, "msgtype": "m.image", "url": "mxc://example.org/aaa" }, "origin_server_ts": -1, "sender": "@---", "type": "m.room.message", "unsigned": { "age": -1 }, "event_id": "$---", "room_id": "!---" } ```
Owner

Thanks, this should now be supported as of 84d791cd8a.

Thanks, this should now be supported as of 84d791cd8ab858eb99c40c292047ed2ac19cf711.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cadence/out-of-your-element#23
No description provided.