Permalink
Browse files

Catch invalid query params (#267)

- Catch negative count -  prevents a server error when trying negative counts ( ?count=-1 for example )
- Catch invalid count or hi parameters (string or float) and force default
  • Loading branch information...
Lvl4Sword authored and dermoth committed Apr 22, 2018
1 parent 9fc960d commit d33f6e85de74e708e11cabe4ed0246e12025c726
Showing with 12 additions and 3 deletions.
  1. +12 −3 Abe/abe.py
View
@@ -415,10 +415,19 @@ def handle_chain(abe, page):
body = page['body']
body += abe.search_form(page)
count = get_int_param(page, 'count') or 20
if count >= 2017:
try:
count = get_int_param(page, 'count') or 20
if count >= 2017:
count = 20
elif count <= 0:
count = 20
except ValueError:
count = 20
hi = get_int_param(page, 'hi')
try:
hi = get_int_param(page, 'hi')
except ValueError:
hi = None
orig_hi = hi
if hi is None:

0 comments on commit d33f6e8

Please sign in to comment.