mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Trap integer overflow errors in search query
This just caused a database error to leak through to the user, but also flooded the logs.
This commit is contained in:
@ -251,13 +251,18 @@ def search(request):
|
||||
}, RequestContext(request))
|
||||
|
||||
# perform the query for general web search
|
||||
curs.execute("SELECT * FROM site_search(%(query)s, %(firsthit)s, %(hitsperpage)s, %(allsites)s, %(suburl)s)", {
|
||||
try:
|
||||
curs.execute("SELECT * FROM site_search(%(query)s, %(firsthit)s, %(hitsperpage)s, %(allsites)s, %(suburl)s)", {
|
||||
'query': query,
|
||||
'firsthit': firsthit - 1,
|
||||
'hitsperpage': hitsperpage,
|
||||
'allsites': allsites,
|
||||
'suburl': suburl
|
||||
})
|
||||
except ProgrammingError:
|
||||
return render_to_response('search/sitesearch.html', {
|
||||
'search_error': 'Error executing search query.'
|
||||
}, RequestContext(request))
|
||||
|
||||
hits = curs.fetchall()
|
||||
conn.close()
|
||||
|
Reference in New Issue
Block a user