use html.escape instead of some self build functions

This commit is contained in:
phail
2022-11-20 12:36:49 +01:00
parent e3c1bde793
commit 073c3c8fed
2 changed files with 5 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
import os
import re
from html import escape
from io import BytesIO
from io import StringIO
@@ -198,12 +199,7 @@ class MailDocumentParser(DocumentParser):
text = "\n".join([str(e) for e in text])
if type(text) != str:
text = str(text)
text = text.replace("&", "&")
text = text.replace("<", "&lt;")
text = text.replace(">", "&gt;")
text = text.replace(" ", " &nbsp;")
text = text.replace("'", "&apos;")
text = text.replace('"', "&quot;")
text = escape(text)
text = clean(text)
text = linkify(text, parse_email=True)
text = text.replace("\n", "<br>")