mirror of
https://github.com/postgres/pgweb.git
synced 2025-07-25 16:02:27 +00:00
Raise a http 404 error on paths that are too long
We never have any paths this long, and it's nicer to raise a proper 404 than a 500 internal server error.
This commit is contained in:
@ -112,6 +112,11 @@ def fallback(request, url):
|
||||
if not re_staticfilenames.match(url):
|
||||
raise Http404('Page not found.')
|
||||
|
||||
if len(url) > 250:
|
||||
# Maximum length is really per-directory, but we shouldn't have any pages/fallback
|
||||
# urls with anywhere *near* that, so let's just limit it on the whole
|
||||
raise Http404('Page not found.')
|
||||
|
||||
try:
|
||||
t = loader.get_template('pages/%s.html' % url)
|
||||
except TemplateDoesNotExist:
|
||||
|
Reference in New Issue
Block a user