Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
media repository: cleanup changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Apr 16, 2022
1 parent c817c63 commit 43ef05e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions synapse/rest/media/v1/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 43ef05e

Please sign in to comment.