404 correctly on missing audio files.

This commit is contained in:
Matthew Stratford 2021-09-25 19:26:04 +01:00
parent 2b2e77fb27
commit 1b6b3aa9c8

View file

@ -426,7 +426,12 @@ async def audio_file(request, type: str, id: int):
filename = get_normalised_filename_if_available(filename) filename = get_normalised_filename_if_available(filename)
# Send file or 404 # Send file or 404
return await file(filename) try:
response = await file(filename)
except FileNotFoundError:
abort(404)
return
return response
# Static Files # Static Files