From 00c148b7518c473ab5ebdbd563efefe372775ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n?= Date: Tue, 5 Dec 2023 23:21:43 +0100 Subject: [PATCH 1/2] Add failing test that should pass after issue is fixed --- .../command/info/test_graph_info_graphical.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/conans/test/integration/command/info/test_graph_info_graphical.py b/conans/test/integration/command/info/test_graph_info_graphical.py index 2d315f28e96..6b6e8896156 100644 --- a/conans/test/integration/command/info/test_graph_info_graphical.py +++ b/conans/test/integration/command/info/test_graph_info_graphical.py @@ -179,7 +179,7 @@ def test_user_templates(): assert template_folder in c.stdout -def test_graph_info_html_output(): +def test_graph_info_html_error_reporting_output(): tc = TestClient() tc.save({"lib/conanfile.py": GenConanfile("lib"), "ui/conanfile.py": GenConanfile("ui", "1.0").with_requirement("lib/1.0"), @@ -212,3 +212,16 @@ def test_graph_info_html_output(): # There used to be a few bugs with weird graphs, check for regressions assert "jinja2.exceptions.UndefinedError" not in tc.out assert "from: ," not in tc.out + + +def test_graph_info_html_error_range_quoting(): + tc = TestClient() + tc.save({"zlib/conanfile.py": GenConanfile("zlib"), + "libpng/conanfile.py": GenConanfile("libpng", "1.0").with_requirement("zlib/[>=1.0]")}) + + tc.run("export zlib --version=1.0") + tc.run("export zlib --version=0.1") + tc.run("export libpng") + + tc.run("graph info --requires=zlib/0.1 --requires=libpng/1.0 --format=html", assert_error=True) + assert 'label: "zlib/[>=1.0]"' not in tc.out From 6c44fa52c24cf0214c9ce99adc5c199f3bd10c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n?= Date: Wed, 6 Dec 2023 00:07:37 +0100 Subject: [PATCH 2/2] Fix range escaping in conflict reports involving ranges --- conan/cli/formatters/graph/info_graph_html.py | 6 ++++-- .../integration/command/info/test_graph_info_graphical.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/conan/cli/formatters/graph/info_graph_html.py b/conan/cli/formatters/graph/info_graph_html.py index 491750bc796..b94ace81419 100644 --- a/conan/cli/formatters/graph/info_graph_html.py +++ b/conan/cli/formatters/graph/info_graph_html.py @@ -82,11 +82,13 @@ // Add error conflict node nodes.push({ id: "{{ error["type"] }}", - label: "{{ error["context"].require.ref }}", + label: {{ error["context"].require.ref|string|tojson }}, shape: "circle", font: { color: "white" }, color: "red", - fulllabel: '

{{ error["context"].require.ref }}

This node creates a conflict in the dependency graph

', + fulllabel: '

' + + {{ error["context"].require.ref|string|tojson }} + + '

This node creates a conflict in the dependency graph

', shapeProperties: { borderDashes: [5, 5] } }) diff --git a/conans/test/integration/command/info/test_graph_info_graphical.py b/conans/test/integration/command/info/test_graph_info_graphical.py index 6b6e8896156..ca1773cf3f9 100644 --- a/conans/test/integration/command/info/test_graph_info_graphical.py +++ b/conans/test/integration/command/info/test_graph_info_graphical.py @@ -224,4 +224,5 @@ def test_graph_info_html_error_range_quoting(): tc.run("export libpng") tc.run("graph info --requires=zlib/0.1 --requires=libpng/1.0 --format=html", assert_error=True) - assert 'label: "zlib/[>=1.0]"' not in tc.out + assert 'zlib/[>=1.0]' not in tc.out + assert r'"zlib/[\u003e=1.0]"' in tc.out