Fix for #1199 (missing referrer)

This commit is contained in:
Ozzieisaacs
2020-02-16 19:39:32 +01:00
parent b152d3e06d
commit ed0bdbf31d
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -179,7 +179,10 @@ def remove_from_shelf(shelf_id, book_id):
if not xhr:
flash(_(u"Book has been removed from shelf: %(sname)s", sname=shelf.name), category="success")
return redirect(request.environ["HTTP_REFERER"])
if "HTTP_REFERER" in request.environ:
return redirect(request.environ["HTTP_REFERER"])
else:
return redirect(url_for('web.index'))
return "", 204
else:
log.error("User %s not allowed to remove a book from %s", current_user, shelf)