thread fix
This commit is contained in:
parent
d58fb8841b
commit
a58ba11566
11 changed files with 177 additions and 30 deletions
|
|
@ -6,6 +6,7 @@ from email.utils import getaddresses, parsedate_to_datetime
|
|||
from html import unescape
|
||||
|
||||
from app.services.message_ids import first_message_id, parse_message_id_list
|
||||
from app.services.reply_extractor import build_reply_display
|
||||
|
||||
|
||||
def _addresses(values: list[str]) -> list[dict[str, str]]:
|
||||
|
|
@ -36,11 +37,7 @@ def _header_str(value) -> str | None:
|
|||
|
||||
|
||||
def _snippet(text: str, html: str | None, limit: int = 240) -> str:
|
||||
source = text
|
||||
if not source and html:
|
||||
source = re.sub(r"<[^>]+>", " ", html)
|
||||
source = unescape(source)
|
||||
return re.sub(r"\s+", " ", source).strip()[:limit]
|
||||
return build_reply_display(body_text=text, body_html=html, limit=limit)["snippet"]
|
||||
|
||||
|
||||
def parse_mime(raw: bytes) -> dict:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue