From 150841377a2654025df3c9410b5ceeee45473ead Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Mon, 12 Jul 2021 16:51:37 +0200 Subject: [PATCH] kb: use html.unescape (#55535) --- welco/kb/search_indexes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/welco/kb/search_indexes.py b/welco/kb/search_indexes.py index ec24f70..5cbafed 100644 --- a/welco/kb/search_indexes.py +++ b/welco/kb/search_indexes.py @@ -14,8 +14,9 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import html + from django.utils.html import strip_tags -from django.utils.six.moves.html_parser import HTMLParser from haystack import indexes @@ -33,7 +34,7 @@ class PageIndex(indexes.SearchIndex, indexes.Indexable): return Page def prepare_text(self, obj): - return obj.title + ' ' + self.prepare_tags(obj) + ' ' + HTMLParser().unescape(strip_tags(obj.content)) + return obj.title + ' ' + self.prepare_tags(obj) + ' ' + html.unescape(strip_tags(obj.content)) def prepare_text_auto(self, obj): return self.prepare_text(obj)