element-hq/hydrogen-web

Blank tile with filename alt instead of picture if dynamic thumbnails disabled on HS

bkil opened this issue · 0 comments

bkil commented

If you are sent an image that has no thumbnail attached and if the client would want to generate one dynamically and your HS has generating dynamic thumbnails disabled (such as on matrix.org), you will get a HTTP 400 with the following body instead of the image:

{"errcode":"M_UNKNOWN","error":"Cannot find any thumbnails for the requested media ([b'oregpreshaz.eu', b'GbhXUxEGpzNdxKlRwYYTUObT']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.)"}

From a Hydrogen perspective, I think it would be worthwhile to

  • Signal any and all errors to the user in some way other than the broken file icon
  • In this special case, provide some other means to access the image, either render the full size image without a smaller thumbnail or after clicking on it or offering a download link, whose URL in this case would be:

https://matrix-client.matrix.org/_matrix/media/r0/download/oregpreshaz.eu/GbhXUxEGpzNdxKlRwYYTUObT

Example faulty rendering:

Event JSON:

{
  "content": {
    "body": "1.jpg",
    "info": {
      "h": 609,
      "mimetype": "image/jpeg",
      "size": 39748,
      "w": 500,
      "xyz.amorgan.blurhash": "TENwV+-q~XxoWCWBRn-rt5M}xtt6"
    },
    "msgtype": "m.image",
    "url": "mxc://oregpreshaz.eu/GbhXUxEGpzNdxKlRwYYTUObT"
  },
  "origin_server_ts": 1680515876737,
  "room_id": "!CwMDVzZXiVUzvlBHdn:grin.hu",
  "sender": "@dani:oregpreshaz.eu",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "$cE4cZAY58PHudxyXdqR5dk648_HsBfDoGmazkjVSYuM",
  "user_id": "@dani:oregpreshaz.eu"
}

Screenshot:

archive matrix org_issues_253_picture_not_showing