From 776f107e876faf04b3020734d526f21a2e05a7bf Mon Sep 17 00:00:00 2001 From: Discookie Date: Mon, 25 Nov 2024 09:40:46 +0000 Subject: [PATCH] Fix setting www_root in CodeChecher server --- web/server/codechecker_server/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/server/codechecker_server/server.py b/web/server/codechecker_server/server.py index 99327ac1b5..56bdae5d02 100644 --- a/web/server/codechecker_server/server.py +++ b/web/server/codechecker_server/server.py @@ -77,8 +77,6 @@ class RequestHandler(SimpleHTTPRequestHandler): def __init__(self, request, client_address, server): self.path = None super().__init__(request, client_address, server) - # GET requests are served from www_root. - self.directory = server.www_root def log_message(self, *args): """ Silencing http server. """ @@ -214,6 +212,9 @@ def do_GET(self): RequestHandler._get_client_host_port(self.client_address) self.auth_session = self.__check_session_cookie() + # GET requests are served from www_root. + self.directory = self.server.www_root + username = self.auth_session.user if self.auth_session else 'Anonymous' LOG.debug("%s:%s -- [%s] GET %s", client_host if not is_ipv6 else '[' + client_host + ']', @@ -244,7 +245,6 @@ def do_GET(self): self.path = "index.html" # Check that the given path is a file. - # The base directory is set to www_root. if not os.path.exists(self.translate_path(self.path)): self.path = 'index.html'