From 96b4f596407d6ab94ccc8b7c49183777d5018223 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 30 2016 15:34:05 +0000 Subject: Be tolerant to markdown processing error Sometime a markdown is wrongly formatted and this will raise an error with this change we default to sending back the cleaned but unformatted text but log the error so admins are aware of it (not sure what they can do but we'll see, if it gets annoying we can always reconsider). --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 41d2a45..540b1ec 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2923,7 +2923,12 @@ def text2markdown(text, extended=True): ) if text: - return clean_input(md_processor.convert(text)) + try: + text = md_processor.convert(text) + except Exception as err: + LOG.exception( + 'A markdown error occured while processing: ``%s``' % text) + return clean_input(text) return ''