mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
bugdown: Log Markdown parser failures
(imported from commit 9e225a32b71edbfd9007cc2fbae32be31896233d)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import markdown
|
import markdown
|
||||||
|
import logging
|
||||||
|
import traceback
|
||||||
|
|
||||||
from zephyr.lib.avatar import gravatar_hash
|
from zephyr.lib.avatar import gravatar_hash
|
||||||
from zephyr.lib.bugdown import codehilite
|
from zephyr.lib.bugdown import codehilite
|
||||||
@@ -61,7 +63,14 @@ def convert(md):
|
|||||||
html = _md_engine.convert(md)
|
html = _md_engine.convert(md)
|
||||||
except:
|
except:
|
||||||
# FIXME: Do something more reasonable here!
|
# FIXME: Do something more reasonable here!
|
||||||
|
#
|
||||||
|
# NB: For security, we must not print the bare Markdown input.
|
||||||
|
# It could contain terminal control codes, which can do
|
||||||
|
# surprisingly nasty things.
|
||||||
|
|
||||||
html = '<p>[Humbug note: Sorry, we could not understand the formatting of your message]</p>'
|
html = '<p>[Humbug note: Sorry, we could not understand the formatting of your message]</p>'
|
||||||
|
logging.getLogger('').error('Exception in Markdown parser: %sInput was: %s'
|
||||||
|
% (traceback.format_exc(), repr(md)))
|
||||||
|
|
||||||
_use_count += 1
|
_use_count += 1
|
||||||
if _use_count >= MAX_MD_ENGINE_USES:
|
if _use_count >= MAX_MD_ENGINE_USES:
|
||||||
|
|||||||
Reference in New Issue
Block a user