Issue 2551093
Created on 2020-10-20 09:42 by ced, last changed 2020-10-23 00:45 by rouilj.
Messages | |||
---|---|---|---|
msg6969 | Author: [hidden] (ced) | Date: 2020-10-20 09:42 | |
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. |
|||
msg6971 | Author: [hidden] (rouilj) | Date: 2020-10-22 14:19 | |
Hi Cédric: I have a patch for this, but I have two questions: 1) currently I am only trapping TypeError rather than Exception. I have a feeling it should trap the latter. Thoughts? 2) should this result in an email to the maintainer similar to other exceptions? -- rouilj |
|||
msg6972 | Author: [hidden] (ced) | Date: 2020-10-22 14:29 | |
On 2020-10-22 14:19, John Rouillard wrote: > 1) currently I am only trapping TypeError rather than Exception. > I have a feeling it should trap the latter. Thoughts? I guess it is safer to catch any exception. > 2) should this result in an email to the maintainer similar to other > exceptions? I do not think if the content is displayed as raw text (so no http error status) because this mean that each time someone consult the issue with a bad message, the administrator will receive a notification. |
|||
msg6984 | Author: [hidden] (rouilj) | Date: 2020-10-23 00:45 | |
Fixed in rev 6275:bda491248fd8. Capturing all Exceptions, no notification to admin. Note that both markdown and mistune implementations handle the ``` foo foo foofoo ``` markup correctly with either code class="language-foo" or code class="lang-foo" tags and classes (respectively). Thanks for the report and info on reproduction Cédric. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-10-23 00:45:50 | rouilj | set | priority: normal status: open -> fixed resolution: fixed messages: + msg6984 |
2020-10-22 14:29:03 | ced | set | messages: + msg6972 |
2020-10-22 14:19:56 | rouilj | set | status: new -> open assignee: rouilj messages: + msg6971 nosy: + rouilj |
2020-10-20 09:42:28 | ced | create |