Merge pull request #841 from mouse-reeve/shelf-error

Shelf page 500s where it should 404
This commit is contained in:
Mouse Reeve 2021-04-01 09:47:29 -07:00 committed by GitHub
commit 493b04d91d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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:
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