summary refs log tree commit diff
path: root/synapse/rest/media/v1/thumbnail_resource.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-02-19 10:46:18 +0000
committerErik Johnston <erik@matrix.org>2021-02-19 10:46:18 +0000
commit3d2acc930f0a633bf400c96f3e636b5b662a54cb (patch)
treeb1ea0bb16319371cf2fedc199a948bc2bf9bd547 /synapse/rest/media/v1/thumbnail_resource.py
parentNewsfile (diff)
downloadsynapse-3d2acc930f0a633bf400c96f3e636b5b662a54cb.tar.xz
Return a 404 if we don't have the original file
Diffstat (limited to 'synapse/rest/media/v1/thumbnail_resource.py')
-rw-r--r--synapse/rest/media/v1/thumbnail_resource.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/thumbnail_resource.py b/synapse/rest/media/v1/thumbnail_resource.py

index c345ec6498..3ab90e9f9b 100644 --- a/synapse/rest/media/v1/thumbnail_resource.py +++ b/synapse/rest/media/v1/thumbnail_resource.py
@@ -340,6 +340,13 @@ class ThumbnailResource(DirectServeJsonResource): # width/height/method so we can just call the "generate exact" # methods. + # First let's check that we do actually have the original image + # still. This will throw a 404 if we don't. + # TODO: We should refetch the thumbnails for remote media. + await self.media_storage.ensure_media_is_in_local_cache( + FileInfo(server_name, file_id, url_cache=url_cache) + ) + if server_name: await self.media_repo.generate_remote_exact_thumbnail( server_name,