fix(reports): safe-fence code-location snippets in markdown copy

This commit is contained in:
Ahmed Allam
2026-07-25 13:09:57 -07:00
committed by Ahmed Allam
parent 21243486e2
commit 95d2e5fba9
+3 -1
View File
@@ -628,7 +628,9 @@ class VulnerabilityDetailScreen(ModalScreen): # type: ignore[misc]
if loc.get("label"): if loc.get("label"):
lines.append(f" {loc['label']}") lines.append(f" {loc['label']}")
if loc.get("snippet"): if loc.get("snippet"):
lines.append(f"```\n{loc['snippet']}\n```") snippet = str(loc["snippet"])
snippet_fence = safe_fence(snippet)
lines.append(f"{snippet_fence}\n{snippet}\n{snippet_fence}")
if loc.get("fix_before") or loc.get("fix_after"): if loc.get("fix_before") or loc.get("fix_after"):
lines.append("**Suggested Fix:**") lines.append("**Suggested Fix:**")
lines.append("```diff") lines.append("```diff")