vecfinder

Document searching tool based on embedding vectors
git clone git://git.finwo.net/app/vecfinder
Log | Files | Refs

commit 18ae78de3d01f59ba6a2d4d811b77b4d45e98c79
parent 53e482afa0a3f56d0ef1b8b85ec124b215081059
Author: finwo <finwo@pm.me>
Date:   Tue, 24 Mar 2026 19:42:15 +0100

Fix system-wide cache dir check

Diffstat:
Mvecfinder.js | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/vecfinder.js b/vecfinder.js @@ -50,13 +50,22 @@ async function createSystemCacheDir() { } try { - await fs.mkdir(cacheBase, { recursive: true, mode: 0o770 }); + await fs.mkdir(cacheBase, { recursive: true }); } catch (err) { if (err.code !== 'EEXIST') return null; } + const cacheStat = await fs.stat(cacheBase).catch(() => null); + if (!cacheStat) return null; + + const mode = cacheStat.mode & 0o777; + const isGroupWritable = !!(mode & fs.constants.S_IWGRP); + + if (isGroupWritable) { + return await getWritableCacheDir(cacheBase); + } + try { - execSync(`chown root:vecfinder "${cacheBase}"`, { stdio: 'ignore' }); execSync(`chmod 0770 "${cacheBase}"`, { stdio: 'ignore' }); } catch { return null;