From 03fd7fd142a35c6e85dbbc812d307bd06ce97bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Mon, 23 Dec 2013 17:42:11 +0100 Subject: [PATCH] Fixed http status code when requesting a non-existing static page using Tordado web server. Fixed #1161. --- CHANGELOG | 4 ++++ openslides/utils/tornado_webserver.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3caf2464a..c639199e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,10 @@ Version 1.5.1 (unreleased) ========================== [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) ======================== diff --git a/openslides/utils/tornado_webserver.py b/openslides/utils/tornado_webserver.py index 6b64df3b0..2558f141a 100644 --- a/openslides/utils/tornado_webserver.py +++ b/openslides/utils/tornado_webserver.py @@ -43,10 +43,10 @@ class DjangoStaticFileHandler(StaticFileHandler): # a shared root prefix # - we do not handle self.default_filename (we do not use it and it # 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) 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