From fd6c1973cfdca5733dae2519d5e16d4d92a34a35 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 1 Apr 2021 07:24:56 -0700 Subject: [PATCH] Shelf page 500s where it should 404 --- bookwyrm/views/shelf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views/shelf.py b/bookwyrm/views/shelf.py index 88982b26e..41d1f1358 100644 --- a/bookwyrm/views/shelf.py +++ b/bookwyrm/views/shelf.py @@ -39,7 +39,10 @@ class Shelf(View): # get the shelf and make sure the logged in user should be able to see it if shelf_identifier: - shelf = user.shelf_set.get(identifier=shelf_identifier) + try: + shelf = user.shelf_set.get(identifier=shelf_identifier) + except models.Shelf.DoesNotExist: + return HttpResponseNotFound() if not object_visible_to_user(request.user, shelf): return HttpResponseNotFound() # this is a constructed "all books" view, with a fake "shelf" obj