fix 500 error if files does not exist on disk
All checks were successful
/ test (push) Successful in 51s
/ deploy (push) Successful in 4m52s

This commit is contained in:
j3d1 2024-12-01 18:09:32 +01:00
parent 2a2ef61fc4
commit 8234fd438a

View file

@ -38,6 +38,8 @@ def media_urls(request, hash):
'Age': 0,
'ETag': file.hash,
})
except FileNotFoundError:
return Response(status=status.HTTP_404_NOT_FOUND)
except File.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
except EmailAttachment.DoesNotExist:
@ -80,6 +82,8 @@ def thumbnail_urls(request, size, hash):
'ETag': file.hash + "_" + str(size),
})
except FileNotFoundError:
return Response(status=status.HTTP_404_NOT_FOUND)
except File.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
except EmailAttachment.DoesNotExist: