From caa54f3ccef4cb1df44944a92824ead9085517cf Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 30 Jul 2024 08:14:33 +0100 Subject: [PATCH] fix: Temp file creation catches realpath error --- src/back/util/misc.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/back/util/misc.ts b/src/back/util/misc.ts index 4dd33b2b5..f8a2d49fc 100644 --- a/src/back/util/misc.ts +++ b/src/back/util/misc.ts @@ -379,7 +379,13 @@ export function getCwd(isDev: boolean, exePath: string) { } export async function getTempFilename(ext = 'tmp') { - return path.join(await fs.promises.realpath(os.tmpdir()), uuid() + '.' + ext); + let tempDir; + try { + tempDir = await fs.promises.realpath(os.tmpdir()); + } catch { + tempDir = os.tmpdir(); + } + return path.join(tempDir, uuid() + '.' + ext); } /**