From ee030ba58f9210c87325910d8e60f04bda315448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= <hugo@lysator.liu.se> Date: Thu, 21 Sep 2023 01:35:30 +0200 Subject: [PATCH] Correctly format error when parsing fails. --- muppet/format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/muppet/format.py b/muppet/format.py index 7294f66..9e19576 100644 --- a/muppet/format.py +++ b/muppet/format.py @@ -211,7 +211,7 @@ def format_class(d_type: DefinedType | PuppetClass) -> Tuple[str, str]: except ParseError as e: logger.error("Parsing %(name)s failed: %(err)s", {'name': d_type.name, 'err': e}) - out += f'<div class="error">{e}</div>' + out += f'<div class="error">{html.escape(str(e))}</div>' out += '<pre><code class="puppet">' if e.pos: out += d_type.source[:e.pos] -- GitLab