Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Fix temp dir fallback to also detect paths with spaces on Windows

Gabriel Stein4305315ee456
diff --git a/src/helpers/safeTempDir.js b/src/helpers/safeTempDir.js
index 72b20d6ab..e85383162 100644
--- a/src/helpers/safeTempDir.js
+++ b/src/helpers/safeTempDir.js
@@ -4,14 +4,18 @@ const path = require("path");
let cachedSafeTempDir = null;
-// Returns an ASCII-safe temp directory for native binaries on Windows.
-// Falls back to ProgramData when TEMP contains non-ASCII characters.
+// Returns a safe temp directory for native binaries on Windows.
+// Falls back to ProgramData when TEMP contains spaces or non-ASCII characters,
+// as many native binaries (whisper-server, ffmpeg) don't handle these paths correctly.
function getSafeTempDir() {
if (cachedSafeTempDir) return cachedSafeTempDir;
const systemTemp = os.tmpdir();
- if (process.platform !== "win32" || /^[\x00-\x7F]*$/.test(systemTemp)) {
+ // On non-Windows platforms, use system temp directly
+ // On Windows, check for problematic characters: non-ASCII or spaces
+ const hasProblematicChars = !/^[\x21-\x7E]*$/.test(systemTemp);
+ if (process.platform !== "win32" || !hasProblematicChars) {
cachedSafeTempDir = systemTemp;
return systemTemp;
}