From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.126.198]) by gnuweeb.org (Postfix) with ESMTPSA id 7E6DF814D9; Wed, 9 Nov 2022 02:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1667962233; bh=YHEUSp2sl36+XaUs+yGiHFlSlVCSAcCvS6j0gIKeOgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XquIqLZCil1+WQpvHGvcsLqMQofS1BJfkuKSGUrT3xOpKdhfgXS8VRlvYeoYXnQqU O++Z56Cnx0+bqKA2RBn1lHp07v+b9+vXE+quTy6FSx6X/vBySp4luGKl+HsEoCBbBD tePrAEugo4OwVKZvexQbWTLxAGeFFtendcTfMGAKL5PC/F4iT8YSnZUCc/KFN+W6oK h6h49GAMdWC0qzv9dzE1AQ3keo/GkxVb1X3r0ERWmr/HFTtq65ByCMNFxC0xb90hEv vI6VCQ2m5SnGa6RtW2fbR/yEeM2vSNlfBkViHzQ8fUMTk9J9fvcKFqDXRJHEewrvjA CWchM2uKnNRTg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 06/17] utils: Improve fix_utf8_char() Date: Wed, 9 Nov 2022 09:49:51 +0700 Message-Id: <20221109025002.258-7-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221109025002.258-1-kiizuha@gnuweeb.org> References: <20221109025002.258-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: Improvement for the fix_utf8_char() to ensure the `>` will be unescaped, because if not use the html.unescape(), the email payload will contain `>` for the Discord bot. Also, change on the html.escape() to use it only once. From the past issue bb8855bf, some email message doesn't escaped correctly, so I use the html.escape() twice. Within the current version, this issue should be fixed and can call the html.escape() just once. Fixes: bb8855bf ("Fix the storage management after the refactor was happened") Signed-off-by: Muhammad Rizki --- daemon/atom/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py index dd9e1a6..c21a4b5 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -258,8 +258,8 @@ def remove_patch(tmp: Union[str, list]): def fix_utf8_char(text: str, html_escape: bool = True): t = text.rstrip().replace("�"," ") if html_escape: - t = html.escape(html.escape(text)) - return t + return html.escape(text) + return html.unescape(t) def get_decoded_payload(payload: Message): -- Muhammad Rizki