From 13c2a4efcc0c61d7074887c221f4f91196dffb6a Mon Sep 17 00:00:00 2001 From: Nithin Gowda R Date: Wed, 28 Oct 2026 09:57:51 +0530 Subject: [PATCH] fix(syft-job): escape HTML before ANSI conversion in stdout/stderr viewers Fixes #9586 Two bugs in StdoutViewer._repr_html_ (job_stdout.py) and StderrViewer._repr_html_ (job_repr.py): Bug 1 - Wrong escaping order: ANSI codes were converted to first, and then '"' was replaced with '"'. Every resulting span became , so the browser ignored the style and coloured output showed up without colours. Bug 2 - Missing HTML escaping: '<' and '>' were never escaped. Any output that looks like an HTML tag (e.g. or tracebacks containing 'in ') was parsed as HTML and disappeared from the view. Output containing " + viewer = _make_stdout_viewer(tmp_path, payload) + html = viewer._repr_html_() + + assert "" + viewer = _make_stderr_viewer(tmp_path, payload) + html = viewer._repr_html_() + + assert "