diff --git a/tools/report-converter/codechecker_report_converter/report/output/html/html.py b/tools/report-converter/codechecker_report_converter/report/output/html/html.py index b049dcaf7b..a7784bf2d8 100644 --- a/tools/report-converter/codechecker_report_converter/report/output/html/html.py +++ b/tools/report-converter/codechecker_report_converter/report/output/html/html.py @@ -309,7 +309,7 @@ def create_index_html(self, output_dir: str): html_report_links.append({'link': html_file, 'report': report}) table_reports = map(lambda data: { - 'link': data['link'], + 'link': os.path.basename(data['link']), 'file-path': data['report']['fileId'], 'report-hash': data['report']['reportHash'], 'checker-name': data['report']['checker']['name'], diff --git a/tools/report-converter/tests/unit/output/html/plist_to_html_test.py b/tools/report-converter/tests/unit/output/html/plist_to_html_test.py index 678556bb46..22d8b44cc1 100644 --- a/tools/report-converter/tests/unit/output/html/plist_to_html_test.py +++ b/tools/report-converter/tests/unit/output/html/plist_to_html_test.py @@ -186,4 +186,10 @@ def test_html_for_inclusion(self): index_html = os.path.join(output_dir, "index.html") with open(index_html, 'r', encoding="utf-8", errors="ignore") as f: - self.assertEqual(len(re.findall('"link": "', f.read())), 3) + content = f.read() + + # There are 3 reports in the test file. + self.assertEqual(len(re.findall('"link": "', content)), 3) + # The links should be relative so the static HTML folder is + # portable. + self.assertNotIn('"link": "/', content)