From 69ed09180ad8fa1e6a1784f7a89da36e1b93bf0e Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Thu, 20 Feb 2025 17:33:17 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixed=20error=20handling=20for?= =?UTF-8?q?=20temp=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/searchmatchscorer.utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/searchmatchscorer.utils.ts b/utils/searchmatchscorer.utils.ts index a6f96fc..61226dc 100644 --- a/utils/searchmatchscorer.utils.ts +++ b/utils/searchmatchscorer.utils.ts @@ -152,8 +152,9 @@ const calculateLevenshteinDistance = async (match: any, rawFileDetails: any) => console.log(rawFileDetails.cover.filePath); const fileName = match.id + "_" + rawFileDetails.name + ".jpg"; // Ensure the `temporary` directory exists - if (!existsSync("temporary")) { - mkdirSync("temporary", { recursive: true }); + const tempDir = path.join(`${process.env.USERDATA_DIRECTORY}`, "temporary"); + if (!existsSync(tempDir)) { + mkdirSync(tempDir, { recursive: true }); } const file = createWriteStream( `${process.env.USERDATA_DIRECTORY}/temporary/${fileName}`