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.125.217]) by gnuweeb.org (Postfix) with ESMTPSA id 903248093B; Mon, 3 Oct 2022 23:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664841176; bh=DM8vwr3VOXzIGM9rmL4sVF0LcrE+n+13CBAaQrerRuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKGxTtunE3MfaUk6qDBuLdTrThyYiyu0I4i+x+v0vtmtc4t4ZWGg8sBWk4VlATOWh pTkkYH2QktiEwqxZqD6Kcz3LtBrGV4wgNQWrF+/uSM0YlLXrr9WjIFPbHKdDbSXvXH wx95XGSy8idcSyPsytJVsXSF7j2yKZjLLRwQ72wC+PcyWt7Zg3ub83Ewv7wWrm56nC 87XafITtSx5kQSUGng3JeOwDj2J1um0nMDN5xhza0kgzXy2Ftm2jUAI6NYl3jNCGNh cibozPVnFk7v2J0ALuHL6yoIa9XcVyIcurZw9aBFjvlYBk6iAh3fstP7xpKGAL+nVA 5T4TNSGbZ0V/w== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 03/28] Fix the empty temporary patch directory on atom/utils.py Date: Tue, 4 Oct 2022 06:52:04 +0700 Message-Id: <20221003235230.1824-4-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221003235230.1824-1-kiizuha@gnuweeb.org> References: <20221003235230.1824-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Change code position of the gen_temp() on the extract_body(). This change should only generate the temporary directory when it's needed to create a patch file inside that temporary directory. Signed-off-by: Muhammad Rizki --- daemon/atom/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py index f813f39..2aa4bce 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -145,7 +145,6 @@ def extract_body(thread: Message, platform: str): ret = "" files = [] - temp = gen_temp(str(uuid.uuid4()), platform) for p in thread.get_payload(): fname = p.get_filename() payload = p.get_payload(decode=True) @@ -157,6 +156,7 @@ def extract_body(thread: Message, platform: str): ret += f"{payload.decode(errors='replace')}\n".lstrip() continue + temp = gen_temp(str(uuid.uuid4()), platform) with open(f"{temp}/{fname}", "wb") as f: f.write(payload) files.append((temp, fname)) -- Muhammad Rizki