From dee7c0f6218e6bdd07b477dc5d9e4b5540ffcf4a Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 26 Jan 2025 11:20:12 +0100 Subject: [PATCH] Enable autoescape for web server's Jinja environment. --- web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web.py b/web.py index 629e63b..813d0fc 100644 --- a/web.py +++ b/web.py @@ -20,7 +20,8 @@ class PlomHttpServer(HTTPServer): def __init__(self, templates_dir: Path, *args, **kwargs) -> None: super().__init__(*args, **kwargs) - self.jinja = JinjaEnv(loader=JinjaFSLoader(templates_dir)) + self.jinja = JinjaEnv(loader=JinjaFSLoader(templates_dir), + autoescape=True) def serve(self) -> None: """Do .serve_forever on .server_port/.server_address until ^C.""" -- 2.30.2