fix 500 error if files does not exist on disk
This commit is contained in:
parent
2a2ef61fc4
commit
8234fd438a
1 changed files with 4 additions and 0 deletions
|
@ -38,6 +38,8 @@ def media_urls(request, hash):
|
||||||
'Age': 0,
|
'Age': 0,
|
||||||
'ETag': file.hash,
|
'ETag': file.hash,
|
||||||
})
|
})
|
||||||
|
except FileNotFoundError:
|
||||||
|
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||||
except File.DoesNotExist:
|
except File.DoesNotExist:
|
||||||
return Response(status=status.HTTP_404_NOT_FOUND)
|
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||||
except EmailAttachment.DoesNotExist:
|
except EmailAttachment.DoesNotExist:
|
||||||
|
@ -80,6 +82,8 @@ def thumbnail_urls(request, size, hash):
|
||||||
'ETag': file.hash + "_" + str(size),
|
'ETag': file.hash + "_" + str(size),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
except FileNotFoundError:
|
||||||
|
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||||
except File.DoesNotExist:
|
except File.DoesNotExist:
|
||||||
return Response(status=status.HTTP_404_NOT_FOUND)
|
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||||
except EmailAttachment.DoesNotExist:
|
except EmailAttachment.DoesNotExist:
|
||||||
|
|
Loading…
Reference in a new issue