diff roundup/cgi/templating.py @ 6275:bda491248fd8

Handle exception raised from markdown processing If an exception is raised from the markdown processor, return plain text to the user.
author John Rouillard <rouilj@ieee.org>
date Thu, 22 Oct 2020 20:43:29 -0400
parents af372b9372f6
children 957a0fc20021
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Thu Oct 22 11:49:14 2020 -0400
+++ b/roundup/cgi/templating.py	Thu Oct 22 20:43:29 2020 -0400
@@ -1730,7 +1730,11 @@
         s = self.plain(escape=0, hyperlink=0)
         if hyperlink:
             s = self.hyper_re.sub(self._hyper_repl_markdown, s)
-        return u2s(markdown(s2u(s)))
+        try:
+            s = u2s(markdown(s2u(s)))
+        except Exception:  # when markdown formatting fails return markup
+            return self.plain(escape=0, hyperlink=hyperlink)
+        return s
 
     def field(self, **kwargs):
         """ Render the property as a field in HTML.

Roundup Issue Tracker: http://roundup-tracker.org/