fix
This commit is contained in:
@@ -151,11 +151,11 @@ def _format_body_content(text_body: str, html_body: str) -> str:
|
|||||||
|
|
||||||
# Detect useless fallback: HTML comments in text, or HTML is 50x+ longer
|
# Detect useless fallback: HTML comments in text, or HTML is 50x+ longer
|
||||||
use_html = html_stripped and (
|
use_html = html_stripped and (
|
||||||
not text_stripped or "<!--" in text_body or len(html_body) > len(text_body) * 50
|
not text_stripped or "<!--" in text_stripped or len(html_stripped) > len(text_stripped) * 50
|
||||||
)
|
)
|
||||||
|
|
||||||
if use_html:
|
if use_html:
|
||||||
content = _html_to_text(html_body)
|
content = _html_to_text(html_stripped)
|
||||||
if len(content) > HTML_BODY_TRUNCATE_LIMIT:
|
if len(content) > HTML_BODY_TRUNCATE_LIMIT:
|
||||||
content = content[:HTML_BODY_TRUNCATE_LIMIT] + "\n\n[Content truncated...]"
|
content = content[:HTML_BODY_TRUNCATE_LIMIT] + "\n\n[Content truncated...]"
|
||||||
return content
|
return content
|
||||||
|
|||||||
Reference in New Issue
Block a user