Skip to content
Snippets Groups Projects
Commit 3d2acc93 authored by Erik Johnston's avatar Erik Johnston
Browse files

Return a 404 if we don't have the original file

parent 2d577283
No related branches found
No related tags found
No related merge requests found
...@@ -244,7 +244,7 @@ class MediaStorage: ...@@ -244,7 +244,7 @@ class MediaStorage:
await consumer.wait() await consumer.wait()
return local_path return local_path
raise Exception("file could not be found") raise NotFoundError()
def _file_info_to_path(self, file_info: FileInfo) -> str: def _file_info_to_path(self, file_info: FileInfo) -> str:
"""Converts file_info into a relative path. """Converts file_info into a relative path.
......
...@@ -340,6 +340,13 @@ class ThumbnailResource(DirectServeJsonResource): ...@@ -340,6 +340,13 @@ class ThumbnailResource(DirectServeJsonResource):
# width/height/method so we can just call the "generate exact" # width/height/method so we can just call the "generate exact"
# methods. # 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: if server_name:
await self.media_repo.generate_remote_exact_thumbnail( await self.media_repo.generate_remote_exact_thumbnail(
server_name, server_name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment