summary refs log tree commit diff
path: root/synapse/rest/media/v1/download_resource.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-06-23 12:00:45 +0100
committerGitHub <noreply@github.com>2017-06-23 12:00:45 +0100
commit4fec80ba6fb89ad4f2e527dbaea6c0c2ec9aa4b6 (patch)
treea2bd30b908118a6e9dff04259e7e2b54d6d6b44a /synapse/rest/media/v1/download_resource.py
parentMerge pull request #2297 from matrix-org/erikj/user_dir_fix (diff)
parentStore URL cache preview downloads seperately (diff)
downloadsynapse-4fec80ba6fb89ad4f2e527dbaea6c0c2ec9aa4b6.tar.xz
Merge pull request #2299 from matrix-org/erikj/segregate_url_cache_downloads
Store URL cache preview downloads separately
Diffstat (limited to 'synapse/rest/media/v1/download_resource.py')
-rw-r--r--synapse/rest/media/v1/download_resource.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/download_resource.py b/synapse/rest/media/v1/download_resource.py

index 39a286b83c..6879249c8a 100644 --- a/synapse/rest/media/v1/download_resource.py +++ b/synapse/rest/media/v1/download_resource.py
@@ -73,7 +73,12 @@ class DownloadResource(Resource): media_type = media_info["media_type"] media_length = media_info["media_length"] upload_name = name if name else media_info["upload_name"] - file_path = self.filepaths.local_media_filepath(media_id) + if media_info["url_cache"]: + # TODO: Check the file still exists, if it doesn't we can redownload + # it from the url `media_info["url_cache"]` + file_path = self.filepaths.url_cache_filepath(media_id) + else: + file_path = self.filepaths.local_media_filepath(media_id) yield respond_with_file( request, media_type, file_path, media_length,