FossilRepo

Harden ticket_detail comment rendering

ragelink 2026-04-08 13:50 trunk
Commit c9d9fe5731c152e5aa4c3ba5731286f3494177829e9c83cd7cb5516e436c198f
--- fossil/__pycache__/views.cpython-314.pyc
+++ fossil/__pycache__/views.cpython-314.pyc
cannot compute difference between binary files
11
--- fossil/__pycache__/views.cpython-314.pyc
+++ fossil/__pycache__/views.cpython-314.pyc
0 annot compute difference between binary files
1
--- fossil/__pycache__/views.cpython-314.pyc
+++ fossil/__pycache__/views.cpython-314.pyc
0 annot compute difference between binary files
1
+5 -1
--- fossil/views.py
+++ fossil/views.py
@@ -780,15 +780,19 @@
780780
raise Http404("Ticket not found")
781781
782782
body_html = mark_safe(sanitize_html(_render_fossil_content(ticket.body, project_slug=slug))) if ticket.body else ""
783783
rendered_comments = []
784784
for c in comments:
785
+ try:
786
+ comment_html = mark_safe(sanitize_html(_render_fossil_content(c["comment"], project_slug=slug)))
787
+ except Exception:
788
+ comment_html = mark_safe(f"<pre>{c['comment']}</pre>")
785789
rendered_comments.append(
786790
{
787791
"user": c["user"],
788792
"timestamp": c["timestamp"],
789
- "html": mark_safe(sanitize_html(_render_fossil_content(c["comment"], project_slug=slug))),
793
+ "html": comment_html,
790794
}
791795
)
792796
793797
return render(
794798
request,
795799
--- fossil/views.py
+++ fossil/views.py
@@ -780,15 +780,19 @@
780 raise Http404("Ticket not found")
781
782 body_html = mark_safe(sanitize_html(_render_fossil_content(ticket.body, project_slug=slug))) if ticket.body else ""
783 rendered_comments = []
784 for c in comments:
 
 
 
 
785 rendered_comments.append(
786 {
787 "user": c["user"],
788 "timestamp": c["timestamp"],
789 "html": mark_safe(sanitize_html(_render_fossil_content(c["comment"], project_slug=slug))),
790 }
791 )
792
793 return render(
794 request,
795
--- fossil/views.py
+++ fossil/views.py
@@ -780,15 +780,19 @@
780 raise Http404("Ticket not found")
781
782 body_html = mark_safe(sanitize_html(_render_fossil_content(ticket.body, project_slug=slug))) if ticket.body else ""
783 rendered_comments = []
784 for c in comments:
785 try:
786 comment_html = mark_safe(sanitize_html(_render_fossil_content(c["comment"], project_slug=slug)))
787 except Exception:
788 comment_html = mark_safe(f"<pre>{c['comment']}</pre>")
789 rendered_comments.append(
790 {
791 "user": c["user"],
792 "timestamp": c["timestamp"],
793 "html": comment_html,
794 }
795 )
796
797 return render(
798 request,
799

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button