mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-31 20:15:44 +00:00
Chore: Import turbohtml lazily in the mail parser
This commit is contained in:
1 parent
28f54bb592
commit
bc051a4ce3
1 file changed
+4
-3
@@ -36,9 +36,6 @@ from humanize import naturalsize
|
||||
from imap_tools import MailAttachment
|
||||
from imap_tools import MailMessage
|
||||
from tika_client import TikaClient
|
||||
from turbohtml.clean import Linkify
|
||||
from turbohtml.clean import linkify
|
||||
from turbohtml.migration.bleach import clean
|
||||
|
||||
from documents.parsers import ParseError
|
||||
from documents.parsers import make_thumbnail_from_pdf
|
||||
@@ -622,6 +619,10 @@ class MailDocumentParser:
|
||||
|
||||
def clean_html(text: str) -> str:
|
||||
"""Attempt to clean, escape, and linkify the given HTML string."""
|
||||
from turbohtml.clean import Linkify
|
||||
from turbohtml.clean import linkify
|
||||
from turbohtml.migration.bleach import clean
|
||||
|
||||
if isinstance(text, list):
|
||||
text = "\n".join([str(e) for e in text])
|
||||
if not isinstance(text, str):
|
||||
|
||||
Reference in new issue
Block a user