Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

We should have an admin api to delete local media #6459

Closed
richvdh opened this issue Dec 3, 2019 · 3 comments
Closed

We should have an admin api to delete local media #6459

richvdh opened this issue Dec 3, 2019 · 3 comments

Comments

@richvdh
Copy link
Member

richvdh commented Dec 3, 2019

For various reasons, it is useful to be able to remove pieces of media from the local content repo. Ideally we'd have an API to do this, which also removes any associated thumbnails.

We have the quarantine_media API, but (a) that applies to rooms rather than individual bits of media (#5956), and (b) it doesn't actually delete the media.

It's also somewhat separate to the ability of users to remove their own media (see https://github.com/matrix-org/matrix-doc/issues/790), which again probably wouldn't actually delete the media files (to allow for moderation), and would send a deletion request over federation.

It's closely related to matrix-org/matrix-spec-proposals#3479, though that is more about finding the media.

@dklimpel
Copy link
Contributor

@richvdh I think about it to write this API. What ist to do? Delete files is only on part. Should we also delete events? Or do you have a hint what is to do (DB tables or anything else)?

@richvdh
Copy link
Member Author

richvdh commented Sep 24, 2020

@dklimpel for this, I was definitely not thinking of deleting events that reference the media: not least because that is hard to do reliably.

If I remember rightly, the reason I wanted this was to remove some large videos that someone had uploaded to our server, without correct copyright.

I think that the things we need to delete, beyond the file media itself, are:

  • any rows in the local_media_repository_thumbnails / remote_media_cache_thumbnails tables, and the corresponding thumbnail files.
  • the row in the local_media_repository / remote_media_cache tables.

dklimpel added a commit to dklimpel/synapse_archive that referenced this issue Oct 11, 2020
related to: matrix-org#6459

Add `DELETE /_synapse/admin/v1/media/<server_name>/<media_id>` to delete
a single file from server
anoadragon453 pushed a commit that referenced this issue Oct 26, 2020
Related to: #6459, #3479

Add `DELETE /_synapse/admin/v1/media/<server_name>/<media_id>` to delete
a single file from server.
@anoadragon453
Copy link
Member

This looks to have been completed now in #8519. Thanks @dklimpel!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants