diff options
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/rest/media/v1/media_repository.py | 5 | ||||
-rw-r--r-- | synapse/rest/media/v1/thumbnail_resource.py | 10 | ||||
-rw-r--r-- | synapse/storage/media_repository.py | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py index 218ba7a083..a9f84365b0 100644 --- a/synapse/rest/media/v1/media_repository.py +++ b/synapse/rest/media/v1/media_repository.py @@ -188,6 +188,11 @@ class MediaRepository(object): respond_404(request) return + user_erased = yield self.store.is_user_erased(media_info['user_id']) + if user_erased: + respond_404(request) + return + self.mark_recently_accessed(None, media_id) media_type = media_info["media_type"] diff --git a/synapse/rest/media/v1/thumbnail_resource.py b/synapse/rest/media/v1/thumbnail_resource.py index aae6e464e8..088e0d9557 100644 --- a/synapse/rest/media/v1/thumbnail_resource.py +++ b/synapse/rest/media/v1/thumbnail_resource.py @@ -96,6 +96,11 @@ class ThumbnailResource(Resource): respond_404(request) return + user_erased = yield self.store.is_user_erased(media_info['user_id']) + if user_erased: + respond_404(request) + return + thumbnail_infos = yield self.store.get_local_media_thumbnails(media_id) if thumbnail_infos: @@ -136,6 +141,11 @@ class ThumbnailResource(Resource): respond_404(request) return + user_erased = yield self.store.is_user_erased(media_info['user_id']) + if user_erased: + respond_404(request) + return + thumbnail_infos = yield self.store.get_local_media_thumbnails(media_id) for info in thumbnail_infos: t_w = info["thumbnail_width"] == desired_width diff --git a/synapse/storage/media_repository.py b/synapse/storage/media_repository.py index e6cdbb0545..4140044e35 100644 --- a/synapse/storage/media_repository.py +++ b/synapse/storage/media_repository.py @@ -39,7 +39,7 @@ class MediaRepositoryStore(BackgroundUpdateStore): {"media_id": media_id}, ( "media_type", "media_length", "upload_name", "created_ts", - "quarantined_by", "url_cache", + "quarantined_by", "url_cache", "user_id", ), allow_none=True, desc="get_local_media", |