diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2020-10-26 18:02:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 17:02:28 +0000 |
commit | 49d72dea2a6804e4795fb9e1cbc1f1bb1354f08f (patch) | |
tree | c39cbcd086b1a9beb9ced705f6d07ae17345aca0 /synapse/rest/media/v1/filepath.py | |
parent | Fix filepath of Dex example config (#8657) (diff) | |
download | synapse-49d72dea2a6804e4795fb9e1cbc1f1bb1354f08f.tar.xz |
Add an admin api to delete local media. (#8519)
Related to: #6459, #3479 Add `DELETE /_synapse/admin/v1/media/<server_name>/<media_id>` to delete a single file from server.
Diffstat (limited to 'synapse/rest/media/v1/filepath.py')
-rw-r--r-- | synapse/rest/media/v1/filepath.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/filepath.py b/synapse/rest/media/v1/filepath.py index 7447eeaebe..9e079f672f 100644 --- a/synapse/rest/media/v1/filepath.py +++ b/synapse/rest/media/v1/filepath.py @@ -69,6 +69,23 @@ class MediaFilePaths: local_media_thumbnail = _wrap_in_base_path(local_media_thumbnail_rel) + def local_media_thumbnail_dir(self, media_id: str) -> str: + """ + Retrieve the local store path of thumbnails of a given media_id + + Args: + media_id: The media ID to query. + Returns: + Path of local_thumbnails from media_id + """ + return os.path.join( + self.base_path, + "local_thumbnails", + media_id[0:2], + media_id[2:4], + media_id[4:], + ) + def remote_media_filepath_rel(self, server_name, file_id): return os.path.join( "remote_content", server_name, file_id[0:2], file_id[2:4], file_id[4:] |