diff --git a/shared/utils/text.py b/shared/utils/text.py index 324cb59..375b963 100644 --- a/shared/utils/text.py +++ b/shared/utils/text.py @@ -87,7 +87,10 @@ def slimdown(text): i_pattern = re.compile(r"(\*)(.*?)\1") u_pattern = re.compile(r"(__)(.*?)\1") - text, n = re.subn(b_pattern, "\\2", text) - text, n = re.subn(i_pattern, "\\2", text) - text, n = re.subn(u_pattern, "\\2", text) - return mark_safe(text) + if text: + text, n = re.subn(b_pattern, "\\2", text) + text, n = re.subn(i_pattern, "\\2", text) + text, n = re.subn(u_pattern, "\\2", text) + return mark_safe(text) + else: + return ""