Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
email_notifications: Run html2text as a subprocess.
Anders Kaseorge10b7f2f3c1c
diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.pyindex 5fc6d186a72..38ff847dc65 100644--- a/zerver/lib/email_notifications.py+++ b/zerver/lib/email_notifications.py@@ -2,12 +2,12 @@import loggingimport re+import subprocessfrom collections import defaultdictfrom datetime import timedeltafrom email.headerregistry import Addressfrom typing import Any, Dict, Iterable, List, Optional, Tuple-import html2textimport lxml.htmlimport pytzfrom bs4 import BeautifulSoup@@ -704,8 +704,8 @@ def enqueue_welcome_emails(user: UserProfile, realm_creation: bool = False) -> Ndef convert_html_to_markdown(html: str) -> str:- parser = html2text.HTML2Text()- markdown = parser.handle(html).strip()+ # html2text is GPL licensed, so run it as a subprocess.+ markdown = subprocess.check_output(["html2text"], input=html, text=True).strip()# We want images to get linked and inline previewed, but html2text will turn# them into links of the form ``, which is