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 1C7BE804D1; Wed, 9 Nov 2022 02:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1667962224; bh=Xifh1KDuJf2Mfe/JlkDXIVd8c0O7OP0VNQXlqx5yjuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vy8qOfXTAcgy8aedHL/1YYvuQsyLnL6p/mz5QWiSWANuYCVGaQpd0g20Hg4sL2Gpo V6kyZpL5Ll1GCzKBZuBExLpvwBbjLhMWGjhPg2MTLxYDQVh3+jJCey84yk6Pm+pe31 ko/K50f1sv6kb9EYhCX+BPL4ww2IF2UH+guurwLYo+0dm52wEYiX70mrl+hOL+pRRu NQdrrCpZ0oe5doiael7pMkAjE/aCwzmaj4OYESrRcNejR5M/QYDT64eECrYrTgMzWE gHECAKv1P/uc5VnBwEEIIl0D0bDsyNRZp+YN0KKw5w26ZhmMkYS4wfwER3r2cumENC amTTqvhN3kJ/g== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 02/17] fix: utils: Fix .patch file payload Date: Wed, 9 Nov 2022 09:49:47 +0700 Message-Id: <20221109025002.258-3-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-Transfer-Encoding: 8bit List-Id: >From the previous version 59d20af, the .patch file payload uses the prepare_patch() `text` parameter that taken from the create_template() `caption` returned which is the caption is already trimmed. With the current fix, this should be use the full email payload instead so its not bothering with the trimmed payload from the create_template(). Fixes: 59d20af ("daemon: Move prepare for patch and clean up patch functions") 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 03453b4..9483d26 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -213,7 +213,7 @@ def create_template(thread: Message, platform: Platform, to=None, cc=None): return ret, files, is_patch -def prepare_patch(mail, text, url, platform: Platform): +def prepare_patch(mail: Message, text, url, platform: Platform): tmp = gen_temp(url, platform) fnm = str(mail.get("subject")) sch = re.search(PATCH_PATTERN, fnm, re.IGNORECASE) @@ -230,7 +230,7 @@ def prepare_patch(mail, text, url, platform: Platform): cap = text.split("\n\n")[0] with open(file, "wb") as f: - f.write(bytes(text, encoding="utf8")) + f.write(mail.get_payload(decode=True)) caption = "#patch #ml" if platform is Platform.TELEGRAM: -- Muhammad Rizki