element-hq / element-hq/synapse
Separately configure max size of remote media (from max size of uploaded media)
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#15489](https://github.com/matrix-org/synapse/issues/15489).
---
**Description:**
I have `max_upload_size` set to 40M. This is great and all, but what if a remote media file is larger than that? Well, Synapse refuses to process it and the file fails to load for the client.
Here's the error the backend returns:
```json
{"errcode":"M_TOO_LARGE","error":"Requested file is too large > 41943040 bytes"}
```
It feels like Synapse is punishing the user for the arbitrary actions of someone else on another homeserver.
I would like to set the max size for remote media separately from `max_upload_size`, maybe around 200M. If we ever implement media purging then it would be real easy to delete the file after a certain number of days and re-download it if a user ever requests it in the future.
Contributor guide
Research direction
Start by tracing how Synapse applies max_upload_size when processing remote media, then identify the configuration and media-processing entry points involved. Define a separate remote-media limit, verify that oversized remote files can be handled up to that limit, and confirm that the existing upload limit remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100