From 2de0fde86873c879961365b4b9ce3904a158e84f Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 26 Jun 2023 12:00:03 +0200 Subject: [PATCH] Minor fix --- src/cover/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cover/views.py b/src/cover/views.py index a12dce73..e89e7962 100644 --- a/src/cover/views.py +++ b/src/cover/views.py @@ -31,7 +31,10 @@ def preview(request, book, chunk=None, rev=None): If chunk and rev number are given, use version from given revision. If rev is not given, use publishable version. """ - chunk = Chunk.get(book, chunk) + try: + chunk = Chunk.get(book, chunk) + except Chunk.DoesNotExist: + raise Http404 if chunk.book.cover and rev is None and not request.GET.get('width') and not request.GET.get('height'): return HttpResponseRedirect(chunk.book.cover.url) -- 2.20.1