From 43ef05e7a0b18b0bdd7c54a86820b063cc300d35 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Fri, 15 Apr 2022 21:44:52 -0600 Subject: [PATCH] media repository: cleanup changes Signed-off-by: Sumner Evans --- synapse/rest/media/v1/media_repository.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py index 45a28bb5ad1c..b245d9c1e1fb 100644 --- a/synapse/rest/media/v1/media_repository.py +++ b/synapse/rest/media/v1/media_repository.py @@ -40,7 +40,6 @@ from synapse.http.site import SynapseRequest from synapse.logging.context import defer_to_thread from synapse.metrics.background_process_metrics import run_as_background_process -from synapse.rest.media.v1.create_resource import CreateResource from synapse.types import UserID from synapse.util.async_helpers import Linearizer from synapse.util.retryutils import NotRetryingDestination @@ -55,6 +54,7 @@ respond_with_responder, ) from .config_resource import MediaConfigResource +from .create_resource import CreateResource from .download_resource import DownloadResource from .filepath import MediaFilePaths from .media_storage import MediaStorage @@ -362,11 +362,12 @@ async def get_local_media( Returns: Resolves once a response has successfully been written to request """ - self.mark_recently_accessed(None, media_id) media_info = await self.get_local_media_info(request, media_id, max_stall_ms) if not media_info: return + self.mark_recently_accessed(None, media_id) + media_type = media_info["media_type"] if not media_type: media_type = "application/octet-stream" @@ -1211,8 +1212,7 @@ def __init__(self, hs: "HomeServer", version: MediaVersion): self.putChild(b"upload", UploadResource(hs, media_repo, False)) self.putChild(b"download", DownloadResource(hs, media_repo)) self.putChild( - b"thumbnail", - ThumbnailResource(hs, media_repo, media_repo.media_storage), + b"thumbnail", ThumbnailResource(hs, media_repo, media_repo.media_storage) ) if hs.config.media.url_preview_enabled: self.putChild(