Commit f8eb5560 by Christian Duvholt

Fix broken markdown output when attachment does not exist

parent c7f8ff0e
...@@ -59,7 +59,8 @@ class AttachmentPreprocessor(markdown.preprocessors.Preprocessor): ...@@ -59,7 +59,8 @@ class AttachmentPreprocessor(markdown.preprocessors.Preprocessor):
})) }))
line = self.markdown.htmlStash.store(html, safe=True) line = self.markdown.htmlStash.store(html, safe=True)
except models.Attachment.DoesNotExist: except models.Attachment.DoesNotExist:
line = line.replace(m.group(1), """<span class="attachment attachment-deleted">Attachment with ID #%s is deleted.</span>""" % attachment_id) html = """<span class="attachment attachment-deleted">Attachment with ID #%s is deleted.</span>""" % attachment_id
line = line.replace(m.group(2), self.markdown.htmlStash.store(html, safe=True))
line = before + line + after line = before + line + after
new_text.append(line) new_text.append(line)
return new_text return new_text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment