also harden the view

pull/1/head
eric 2016-06-20 13:16:37 -04:00
parent bb9bd032b1
commit 6d3c5f2aca
1 changed files with 5 additions and 1 deletions

View File

@ -2220,7 +2220,11 @@ def search(request):
q = request.GET.get('q', '')
ty = request.GET.get('ty', 'g') # ge= 'general, au= 'author'
request.session['q']=q
page = int(request.GET.get('page', 1))
try:
page = int(request.GET.get('page', 1))
except ValueError:
# garbage in page
page = 1
gbo = request.GET.get('gbo', 'n') # gbo is flag for google books only
our_stuff = Q(is_free=True) | Q(campaigns__isnull=False )
if q != '' and page==1 and not gbo=='y':