[issue2551093] Exception raised when rendering invalid markdown

Cédric Krier <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from Cédric Krier:

One of our user used fenced code block with attribute but it raises an exception that is not catched:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/roundup/cgi/client.py", line 1876, in renderContext
    result = pt.render(self, None, None, **args)
  File "/usr/lib/python3.7/site-packages/roundup/cgi/engine_jinja2.py", line 93, in render
    s = self._tpl.render(c)
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/roundup/html/issue.item.html", line 2, in top-level template code
    {% set bots = ['reviewbot', 'roundup-bot'] %}
  File "/home/roundup/html/layout/page.html", line 21, in top-level template code
    {% block page_content %}
  File "/home/roundup/html/layout/page.html", line 59, in block "page_content"
    {% block content %} {% endblock %}
  File "/home/roundup/html/issue.item.html", line 113, in block "content"
    <div class="msg">{{ utils.codereview_replace(utils.mercurial_replace(msg.content.markdown()))|u|safe }}</div>
  File "/usr/lib/python3.7/site-packages/roundup/cgi/templating.py", line 1733, in markdown
    return u2s(markdown(s2u(s)))
  File "/usr/lib/python3.7/site-packages/roundup/cgi/templating.py", line 72, in <lambda>
    markdown = lambda s: Markdown(safe_mode='escape', extras={ 'fenced-code-blocks' : True }).convert(s)
  File "/usr/lib/python3.7/site-packages/markdown2.py", line 366, in convert
    text = self._do_fenced_code_blocks(text)
  File "/usr/lib/python3.7/site-packages/markdown2.py", line 1883, in _do_fenced_code_blocks
    return self._fenced_code_block_re.sub(self._fenced_code_block_sub, text)
  File "/usr/lib/python3.7/site-packages/markdown2.py", line 1879, in _fenced_code_block_sub
    return self._code_block_sub(match, is_fenced_code_block=True)
  File "/usr/lib/python3.7/site-packages/markdown2.py", line 1824, in _code_block_sub
    **formatter_opts)
TypeError: _color_with_pygments() argument after ** must be a mapping, not bool


I think this should not prevent roundup to render the message as plain text.

----------
components: Web interface
messages: 6969
nosy: ced
severity: major
status: new
title: Exception raised when rendering invalid markdown
type: crash
versions: 2.0.0

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551093>
_________________________________________________


_______________________________________________
Roundup-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.