element-hq / element-hq/synapse
Delete Media on Media storage providers
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#16475](https://github.com/matrix-org/synapse/issues/16475).
---
**Description:**
Currently the implementation for the [media_storage_providers](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html?highlight=storage#media_storage_providers) is only able to upload and download - with options whether or not to store locally uploaded files and / or to store remote media (media cache), however we can only delete local media files.
When looking at the code, we only delete local files:
- [delete_old_remote_media](
https://github.com/matrix-org/synapse/blob/f710d5480bc965a4697d42d293f1f46ee9905603/synapse/media/media_repository.py#L945C15-L945C38)
- [_remove_local_media_from_disk](https://github.com/matrix-org/synapse/blob/f710d5480bc965a4697d42d293f1f46ee9905603/synapse/media/media_repository.py#L1029)
There are probably some questions which have to be answered first:
- Should the deletion be optional? (e.g. option in config)
- Would the implementation break existing storage providers?
- Is this "feature" even something we want?
I am personally running a server with the [synapse-s3-storage-provider](https://github.com/matrix-org/synapse-s3-storage-provider) and noticed relatively late, that it's basically append only, meaning the s3 storage will continuously grow without being able to delete old/unused media. (Related Github Issue https://github.com/matrix-org/synapse-s3-storage-provider/issues/96)
I may or may not be able to contribute, I would need to setup a dev environment for that.
Contributor guide
Assessment
This issue has not been assessed yet.