element-hq / element-hq/hydrogen-web

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

Open
#1,110 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
714
Forks
131
PR merge metrics
No merged PRs in 30d

Description

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:

* https://archive.matrix.org/r/fun:grin.hu/date/2023/04/12T00:12:47?at=$cE4cZAY58PHudxyXdqR5dk648_HsBfDoGmazkjVSYuM

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](https://github.com/matrix-org/matrix-public-archive/assets/818763/e910475a-f6d6-4dfa-8ff2-a82c97bd98a1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.