diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 9b4b6e12..542b8753 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -499,7 +499,8 @@ class runbot_repo(models.Model): nginx_config = self.env['ir.ui.view'].render_template("runbot.nginx_config", settings) os.makedirs(nginx_dir, exist_ok=True) - open(os.path.join(nginx_dir, 'nginx.conf'), 'wb').write(nginx_config) + with open(os.path.join(nginx_dir, 'nginx.conf'), 'wb') as nginx_file: + nginx_file.write(nginx_config) try: _logger.debug('reload nginx') pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n')) diff --git a/runbot/templates/nginx.xml b/runbot/templates/nginx.xml index d4f41f72..ac7aff22 100644 --- a/runbot/templates/nginx.xml +++ b/runbot/templates/nginx.xml @@ -39,7 +39,7 @@ server { location /runbot/static/ { alias ; autoindex off; - location ~ /runbot/static/build/[^/]+/logs/ { + location ~ /runbot/static/build/[^/]+/(logs|tests)/ { autoindex on; } }