matrix-hacks / matrix-puppet-facebook

a puppetted facebook bridge
98 stars 21 forks source link

Image embeds don't work on Riot Android #48

Open tfreedman opened 5 years ago

tfreedman commented 5 years ago

If a facebook user uploads an image, it'll show up in Riot Desktop. However, the Android app will just have a perpetual loading indicator, as the app fails to render the media. My guess is MIME types (e.g.:)

"info": {
      "mimetype": "image/whatever"
}

are being left off the media upload by the bridge, and Riot for Android is stricter about parsing things with an unspecified MIME type. It's possible my theory is totally wrong, though this should be fixed anyhow.

thomas-profitt commented 5 years ago

In Riot, would you click the "(...)" button in the upper-right corner of one of the image messages, select "View Source", and post the "content" section of the message's source, redacting the URL (for your privacy), e.g.:

"content": {
    "url": "REDACTED",
    "info": {
      "mimetype": "image/png",
      "size": 26975
    },
    "body": "image.png",
    "msgtype": "m.image"
  },
tfreedman commented 5 years ago

Here's an example image that doesn't work in Riot Android:

{
  "origin_server_ts": 1550759327266,
  "sender": "@facebook_AAA:tylerfreedman.com",
  "event_id": "$BBB:tylerfreedman.com",
  "unsigned": {
    "age": 6858279
  },
  "content": {
    "url": "mxc://tylerfreedman.com/ZZZ",
    "info": {
      "h": 432,
      "w": 576,
      "size": 59511
    },
    "body": "image-YYY,
    "msgtype": "m.image"
  },
  "type": "m.room.message",
  "room_id": "!XXX:tylerfreedman.com"
}

Here's an example dump of an image that some software I wrote uploaded, which does work:

{
  "origin_server_ts": 1550954650824,
  "sender": "@server:tylerfreedman.com",
  "event_id": "$AAA:tylerfreedman.com",
  "unsigned": {
    "age": 21119808
  },
  "content": {
    "body": "BBB",
    "url": "mxc://tylerfreedman.com/CCC",
    "info": {
      "mimetype": "image/jpeg",
      "h": 799,
      "w": 1057,
      "size": 119403
    },
    "msgtype": "m.image"
  },
  "type": "m.room.message",
  "room_id": "!DDD:tylerfreedman.com"
}

Both work in Riot for Windows