From 227921940403781721c96e6b6f94b428c20af157 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 22 Feb 2023 22:12:50 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B7=A5=E5=8D=95=E5=A4=87=E6=B3=A8=20?= =?UTF-8?q?markdown=20(#9706)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/tickets/handlers/base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/tickets/handlers/base.py b/apps/tickets/handlers/base.py index cfe2a526b..6548bfa8f 100644 --- a/apps/tickets/handlers/base.py +++ b/apps/tickets/handlers/base.py @@ -1,14 +1,13 @@ import html2text - -from django.utils.translation import ugettext as _ from django.template.loader import render_to_string +from django.utils.translation import ugettext as _ from common.utils import get_logger +from tickets.const import TicketState, TicketType from tickets.utils import ( send_ticket_processed_mail_to_applicant, send_ticket_applied_mail_to_assignees ) -from tickets.const import TicketState, TicketType logger = get_logger(__name__) @@ -112,4 +111,6 @@ class BaseHandler: @staticmethod def safe_html_script(unsafe_html): - return html2text.html2text(unsafe_html) + unsafe_html = unsafe_html.replace('\n', '') + html_str = html2text.html2text(unsafe_html) + return html_str