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=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.1.2] (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id D95CB804D1; Fri, 21 Oct 2022 07:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666337719; bh=DVJFN7M57VSyuBVXc/17imuBVfjs7wYdHBZNceuN9fA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZKe94NcNtLTyumFyPP9LEcw0iNsDoDTXqgKmzPZ4sIDatH7mwvpUGqQix6nTU/j2P hsXUAlhgaQvt9lR9GwZo7mccUkcjzxVSDzAmHtfItcO1NBCxlbYT14LfOulgMtdsS3 2cjK7c39I9OzC9ahzF1jMfXLiNwOhtLaaG1tCmDccDS8fIBcwQDSZ/h9WOH8YyDwa3 TUwQ1Q2RJc7BuYHkaZaoqANG22cTh6st6IAfjPbJNc06V587iWQCf51pZkA4uLb3Aa Qz7adLCljpse2Y9Fj9FCZgge4IlCyo+N2sX1sUgjDwyvEFWPZ9FAOUs12qiTMwzv4I NBFO3+YZVnCYg== Message-ID: <0df4bf8d-5b49-6fd2-37ad-2774862b18b1@gnuweeb.org> Date: Fri, 21 Oct 2022 14:35:15 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v2 4/8] atom: Small change for fix_utf8_char() To: Ammar Faizi Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List References: <20221020083845.907-1-kiizuha@gnuweeb.org> <20221020083845.907-5-kiizuha@gnuweeb.org> Content-Language: en-US From: Muhammad Rizki In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: On 21/10/2022 13.53, Ammar Faizi wrote: > On 10/20/22 3:38 PM, Muhammad Rizki wrote: >> Change the parameter to unescape with boolean type and change from >> html.escape to html.unescape for the Discord bot. >> >> Signed-off-by: Muhammad Rizki >> --- >>   daemon/atom/utils.py | 8 ++++---- >>   1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py >> index a30d5cb..c95612e 100644 >> --- a/daemon/atom/utils.py >> +++ b/daemon/atom/utils.py >> @@ -206,7 +206,7 @@ def create_template(thread: Message, platform: >> str, to=None, cc=None): >>           if len(ret) >= substr: >>               ret = ret[:substr] + "..." >> -        ret = fix_utf8_char(ret, platform == "telegram") >> +        ret = fix_utf8_char(ret, platform == "discord") >>           ret += border >>       return ret, files, is_patch >> @@ -242,10 +242,10 @@ def remove_patch(tmp): >>       shutil.rmtree(tmp) >> -def fix_utf8_char(text: str, html_escape: bool = True): >> +def fix_utf8_char(text: str, unescape: bool = True): >>       t = text.rstrip().replace("�"," ") >> -    if html_escape: >> -        t = html.escape(html.escape(text)) >> +    if unescape: >> +        t = html.unescape(html.unescape(text)) >>       return t > > This is broken. > > I tested this series, but didn't have time to bisect it. After I > managed to bisect the issue, I found that the issue is introduced > by this patch. > > See before and after below, anything inside the angle brackets is > gone. The sample is using this email: > > https://lore.kernel.org/io-uring/f905c8cb-702f-6b2c-8954-1a736feb1ee7@kernel.dk/raw > > ------------- > Before this patch: > > #ml > From: Jens Axboe > To: Ammar Faizi > To: Dylan Yudaken > Cc: Pavel Begunkov > Cc: GNU/Weeb Mailing List > Cc: io-uring Mailing List > Cc: Facebook Kernel Team > Cc: Dylan Yudaken > > ------------- > After this patch: > > #ml > From: Jens Axboe > To: Ammar Faizi > To: Dylan Yudaken > Cc: Pavel Begunkov > Cc: GNU/Weeb Mailing List > Cc: io-uring Mailing List > Cc: Facebook Kernel Team > Cc: Dylan Yudaken > That's very strange https://i.ibb.co/z57n0LJ/image.png