Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

markdown: Linkify RFC2392 'mid:' URLs.

Nithyaraj Mudhaliyaree246b2cda80
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
index c84b2d2a08b..afd0c9f89a3 100644
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -97,7 +97,7 @@ html_safelisted_schemes = (
"wtai",
"xmpp",
)
-allowed_schemes = ("http", "https", "ftp", "file", *html_safelisted_schemes)
+allowed_schemes = ("http", "https", "ftp", "file", "mid", *html_safelisted_schemes)
class LinkInfo(TypedDict):
diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.json
index 191d086cc95..c2b9af2793d 100644
--- a/zerver/tests/fixtures/markdown_test_cases.json
+++ b/zerver/tests/fixtures/markdown_test_cases.json
@@ -1080,6 +1080,16 @@
"input": "Hello @_**Zoe|7** see [this](https://google.com).",
"expected_output": "<p>Hello <span class=\"user-mention silent\" data-user-id=\"7\">Zoe</span> see <a href=\"https://google.com\">this</a>.</p>",
"text_content": "Hello Zoe see this."
+ },
+ {
+ "name": "RFC2392 mid links (markdown syntax)",
+ "input": "[message](mid:[email protected])",
+ "expected_output": "<p><a href=\"mid:[email protected]\">message</a></p>"
+ },
+ {
+ "name": "RFC2392 mid links with part ID (markdown syntax)",
+ "input": "[message](mid:[email protected]/[email protected])",
+ "expected_output": "<p><a href=\"mid:[email protected]/[email protected]\">message</a></p>"
}
],
"linkify_tests": [