Fixed http status code when requesting a non-existing static page using Tordado web server. Fixed #1161.

This commit is contained in:
Norman Jäckel 2013-12-23 17:42:11 +01:00
parent b4e8b90656
commit 03fd7fd142
2 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,10 @@ Version 1.5.1 (unreleased)
========================== ==========================
[https://github.com/OpenSlides/OpenSlides/issues?milestone=15] [https://github.com/OpenSlides/OpenSlides/issues?milestone=15]
Other:
- Fixed http status code when requesting a non-existing static page using
Tordado web server.
Version 1.5 (2013-11-25) Version 1.5 (2013-11-25)
======================== ========================

View File

@ -43,10 +43,10 @@ class DjangoStaticFileHandler(StaticFileHandler):
# a shared root prefix # a shared root prefix
# - we do not handle self.default_filename (we do not use it and it # - we do not handle self.default_filename (we do not use it and it
# does not make much sense here anyway) # does not make much sense here anyway)
if not os.path.exists(absolute_path): if absolute_path is None or not os.path.exists(absolute_path):
raise HTTPError(404) raise HTTPError(404)
if not os.path.isfile(absolute_path): if not os.path.isfile(absolute_path):
raise HTTPError(403, "%s is not a file", self.path) raise HTTPError(403, 'The requested resource is not a file.')
return absolute_path return absolute_path