From 81639d2e2de358becc3a69dcfb5190b2e371ee0c Mon Sep 17 00:00:00 2001 From: bai Date: Wed, 24 Apr 2019 20:47:45 -0400 Subject: Deshabilitado uso de BeautifulSoup. Ya no usamos HTML por lo que su uso es innecesario. Es una librería de mierda por lo demás. --- cgi/formatting.py | 10 +++++++--- cgi/post.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'cgi') diff --git a/cgi/formatting.py b/cgi/formatting.py index 6b2d8bc..373d685 100644 --- a/cgi/formatting.py +++ b/cgi/formatting.py @@ -43,8 +43,8 @@ def format_post(message, ip, parentid, parent_timestamp=0): if Settings.VIDEO_THUMBS: (message, affected) = videoThumbs(message) - if affected: - message = close_html(message) + #if affected: + # message = close_html(message) message = clickableURLs(message) message = checkRefLinks(message, parentid, parent_timestamp) @@ -299,7 +299,11 @@ def close_html(message): Old retarded version of sanitize_html, it just closes open tags. """ import BeautifulSoup - return unicode(BeautifulSoup.BeautifulSoup(message)).replace(' ', '').encode('utf-8') + + message = message.encode('utf-8') + soup = BeautifulSoup.BeautifulSoup(message) + + return unicode(soup).replace(' ', '').encode('utf-8') def sanitize_html(message, decode=True): """ diff --git a/cgi/post.py b/cgi/post.py index 9d6f9c2..8937054 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -179,7 +179,7 @@ def shortenMsg(message, elid='0', elboard='0'): if len(message_shortened) > limit: message_shortened = message_shortened[:limit] - message_shortened = formatting.close_html(message_shortened) + #message_shortened = formatting.close_html(message_shortened) return True, message_shortened else: -- cgit v1.2.1-18-gbd029