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.

push_notifications: Handle empty rendered_messages.

Alex Vandiver8c7295995145
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index 6312ca25c59..79ed28761ab 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -636,7 +636,7 @@ def get_mobile_push_content(rendered_content: str) -> str:
+ "*"
)
- elem = lxml.html.fromstring(rendered_content)
+ elem = lxml.html.fragment_fromstring(rendered_content, create_parent=True)
plain_text = process(elem)
return plain_text
diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.json
index c449e0ed5a0..892119ba5ba 100644
--- a/zerver/tests/fixtures/markdown_test_cases.json
+++ b/zerver/tests/fixtures/markdown_test_cases.json
@@ -1,5 +1,11 @@
{
"regular_tests": [
+ {
+ "name": "empty",
+ "input": "",
+ "expected_output": "",
+ "text_content": ""
+ },
{
"name": "codeblock_hilite",
"input": "Hamlet said:\n~~~~.python \ndef speak(self):\n x = 1\n~~~~",