mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-07 02:17:00 +02:00
Log when we respond with 404
This commit is contained in:
parent
a4c5e4a645
commit
c5b589f2e8
2 changed files with 8 additions and 1 deletions
|
@ -285,6 +285,7 @@ class MediaRepository(object):
|
||||||
# If we have an entry in the DB, try and look for it
|
# If we have an entry in the DB, try and look for it
|
||||||
if media_info:
|
if media_info:
|
||||||
if media_info["quarantined_by"]:
|
if media_info["quarantined_by"]:
|
||||||
|
logger.info("Media is quarentined")
|
||||||
raise NotFoundError()
|
raise NotFoundError()
|
||||||
|
|
||||||
responder = yield self.media_storage.fetch_media(file_info)
|
responder = yield self.media_storage.fetch_media(file_info)
|
||||||
|
|
|
@ -85,6 +85,7 @@ class ThumbnailResource(Resource):
|
||||||
media_info = yield self.store.get_local_media(media_id)
|
media_info = yield self.store.get_local_media(media_id)
|
||||||
|
|
||||||
if not media_info or media_info["quarantined_by"]:
|
if not media_info or media_info["quarantined_by"]:
|
||||||
|
logger.info("Media is quarantined")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ class ThumbnailResource(Resource):
|
||||||
responder = yield self.media_storage.fetch_media(file_info)
|
responder = yield self.media_storage.fetch_media(file_info)
|
||||||
yield respond_with_responder(request, responder, t_type, t_length)
|
yield respond_with_responder(request, responder, t_type, t_length)
|
||||||
else:
|
else:
|
||||||
|
logger.info("Couldn't find any generated thumbnails")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -120,6 +122,7 @@ class ThumbnailResource(Resource):
|
||||||
media_info = yield self.store.get_local_media(media_id)
|
media_info = yield self.store.get_local_media(media_id)
|
||||||
|
|
||||||
if not media_info or media_info["quarantined_by"]:
|
if not media_info or media_info["quarantined_by"]:
|
||||||
|
logger.info("Media is quarantined")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -159,6 +162,7 @@ class ThumbnailResource(Resource):
|
||||||
if file_path:
|
if file_path:
|
||||||
yield respond_with_file(request, desired_type, file_path)
|
yield respond_with_file(request, desired_type, file_path)
|
||||||
else:
|
else:
|
||||||
|
logger.warn("Failed to generate local thumbnail")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -197,7 +201,7 @@ class ThumbnailResource(Resource):
|
||||||
yield respond_with_responder(request, responder, t_type, t_length)
|
yield respond_with_responder(request, responder, t_type, t_length)
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.debug("We don't have a local thumbnail of that size. Generating")
|
logger.debug("We don't have a remote thumbnail of that size. Generating")
|
||||||
|
|
||||||
# Okay, so we generate one.
|
# Okay, so we generate one.
|
||||||
file_path = yield self.media_repo.generate_remote_exact_thumbnail(
|
file_path = yield self.media_repo.generate_remote_exact_thumbnail(
|
||||||
|
@ -208,6 +212,7 @@ class ThumbnailResource(Resource):
|
||||||
if file_path:
|
if file_path:
|
||||||
yield respond_with_file(request, desired_type, file_path)
|
yield respond_with_file(request, desired_type, file_path)
|
||||||
else:
|
else:
|
||||||
|
logger.warn("Failed to generate remote thumbnail")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -241,6 +246,7 @@ class ThumbnailResource(Resource):
|
||||||
responder = yield self.media_storage.fetch_media(file_info)
|
responder = yield self.media_storage.fetch_media(file_info)
|
||||||
yield respond_with_responder(request, responder, t_type, t_length)
|
yield respond_with_responder(request, responder, t_type, t_length)
|
||||||
else:
|
else:
|
||||||
|
logger.info("Failed to find any generated thumbnails")
|
||||||
respond_404(request)
|
respond_404(request)
|
||||||
|
|
||||||
def _select_thumbnail(self, desired_width, desired_height, desired_method,
|
def _select_thumbnail(self, desired_width, desired_height, desired_method,
|
||||||
|
|
Loading…
Reference in a new issue