Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
markdown: Escape lang when echoing back custom non-pygments languages.
Sumanth V Rao564b199fe61b
diff --git a/zerver/lib/markdown/fenced_code.py b/zerver/lib/markdown/fenced_code.pyindex 56093b5f957..ed116b88606 100644--- a/zerver/lib/markdown/fenced_code.py+++ b/zerver/lib/markdown/fenced_code.py@@ -416,7 +416,12 @@ class FencedBlockPreprocessor(markdown.preprocessors.Preprocessor):# still tag it with the user's data-code-language# value, since this allows hooking up a "playground"# for custom "languages" that aren't known to Pygments.- code_language = lang+ #+ # The escaping isn't strictly necessary, in that the+ # characters allowed for language values should all be+ # safe, but doing escaping here makes it easy to+ # reason about.+ code_language = self._escape(lang)div_tag.attrib['data-code-language'] = code_language# lxml implicitly converts tags like <span></span> into <span/>.