mirror of https://github.com/zulip/zulip.git
email_notifications: Run html2text as a subprocess.
html2text is GPL licensed. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5529639b84
commit
e10b7f2f3c
|
@ -2,12 +2,12 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
from collections import defaultdict
|
||||
from datetime import timedelta
|
||||
from email.headerregistry import Address
|
||||
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
||||
|
||||
import html2text
|
||||
import lxml.html
|
||||
import pytz
|
||||
from bs4 import BeautifulSoup
|
||||
|
@ -704,8 +704,8 @@ def enqueue_welcome_emails(user: UserProfile, realm_creation: bool = False) -> N
|
|||
|
||||
|
||||
def 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 `![](http://foo.com/image.png)`, which is
|
||||
|
|
Loading…
Reference in New Issue