element-hq / element-hq/synapse

Silent fail when generating remote thumbnails for pictures over homeserver's `max_image_pixels`

Open
#6,435 0 comments 0 reactions 0 assignees View on GitHub
A-Media-Repository A-Profiles O-Uncommon S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#6435](https://github.com/matrix-org/synapse/issues/6435).

---

### Description
Let's say a homeserver A have a limit of 70M for its `max_pixels` (called `max_image_pixels` nowadays) thumbnailing scheme, while homeserver B have a limit, say, twice as low. A picture could be accepted as an avatar in homeserver A while homeserver B wouldn't be able to view this avatar as it wouldn't be able to generate thumbnails for this file.

More concrete example: https://matrix.org/_matrix/media/r0/download/matrix.org/JLjvxdzheErDJmtsHkbJraNQ is a 8192x8192 avatar. The default configuration for homeservers sets `max_pixels` as `32M`, which is below matrix.org limit. This makes the avatar unviewable and it either reverts to the standard letter one or shows a broken image altogether in Riot.

At the very least we should make it so homeserver B does not return a `M_NOT_FOUND` but an actual error message. We might want to either force generation of thumbnails for avatars or add an UI to notify the user that it failed and to contact his system administrator.

### Steps to reproduce

- Upload an avatar in homeserver A < max_pixels(A) but > max_pixels(B)
- See that avatar federation is broken on homeserver B
### Version information

- **Version**:
```
{
"python_version": "3.6.9",
"server_version": "1.6.1"
}
```

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.