| | @@ -768,51 +768,25 @@ |
| 768 | 768 | }, |
| 769 | 769 | ) |
| 770 | 770 | |
| 771 | 771 | |
| 772 | 772 | def ticket_detail(request, slug, ticket_uuid): |
| 773 | | - import logging |
| 774 | | - import traceback as tb_mod |
| 775 | | - |
| 776 | | - logger = logging.getLogger("fossil.views") |
| 777 | | - |
| 778 | | - try: |
| 779 | | - return _ticket_detail_inner(request, slug, ticket_uuid) |
| 780 | | - except Exception: |
| 781 | | - logger.exception("ticket_detail 500 for %s/%s", slug, ticket_uuid) |
| 782 | | - with open("/tmp/fossilrepo_ticket_detail_error.log", "a") as f: |
| 783 | | - f.write(f"\n--- {ticket_uuid} ---\n") |
| 784 | | - tb_mod.print_exc(file=f) |
| 785 | | - raise |
| 786 | | - |
| 787 | | - |
| 788 | | -def _ticket_detail_inner(request, slug, ticket_uuid): |
| 789 | | - import logging |
| 790 | | - |
| 791 | | - logger = logging.getLogger("fossil.views") |
| 792 | | - |
| 793 | 773 | project, fossil_repo, reader = _get_repo_and_reader(slug, request) |
| 794 | 774 | |
| 795 | 775 | with reader: |
| 796 | 776 | ticket = reader.get_ticket_detail(ticket_uuid) |
| 797 | 777 | comments = reader.get_ticket_comments(ticket_uuid) if ticket else [] |
| 798 | 778 | |
| 799 | 779 | if not ticket: |
| 800 | 780 | raise Http404("Ticket not found") |
| 801 | 781 | |
| 802 | | - try: |
| 803 | | - body_html = mark_safe(sanitize_html(_render_fossil_content(ticket.body, project_slug=slug))) if ticket.body else "" |
| 804 | | - except Exception: |
| 805 | | - logger.exception("ticket_detail: failed to render body for %s", ticket_uuid) |
| 806 | | - body_html = mark_safe(f"<pre>{ticket.body}</pre>") if ticket.body else "" |
| 807 | | - |
| 782 | + body_html = mark_safe(sanitize_html(_render_fossil_content(ticket.body, project_slug=slug))) if ticket.body else "" |
| 808 | 783 | rendered_comments = [] |
| 809 | 784 | for c in comments: |
| 810 | 785 | try: |
| 811 | 786 | comment_html = mark_safe(sanitize_html(_render_fossil_content(c["comment"], project_slug=slug))) |
| 812 | 787 | except Exception: |
| 813 | | - logger.exception("ticket_detail: failed to render comment for %s", ticket_uuid) |
| 814 | 788 | comment_html = mark_safe(f"<pre>{c['comment']}</pre>") |
| 815 | 789 | rendered_comments.append( |
| 816 | 790 | { |
| 817 | 791 | "user": c["user"], |
| 818 | 792 | "timestamp": c["timestamp"], |
| 819 | 793 | |