mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 21:29:11 +00:00
Fix indexing files in sub-folders on the Desktop app
- `fs.readdir' func in node version 18.18.2 has buggy `recursive' option See nodejs/node#48640, effect-ts/effect#1801 for details - We were recursing down a folder in two ways on the Desktop app. Remove `recursive: True' option to the `fs.readdirSync' method call to recurse down via app code only
This commit is contained in:
@@ -121,17 +121,17 @@ async function isPlainTextFile(filePath) {
|
||||
}
|
||||
|
||||
async function processDirectory(filesToPush, folder) {
|
||||
const files = fs.readdirSync(folder.path, { withFileTypes: true, recursive: true });
|
||||
const files = fs.readdirSync(folder.path, { withFileTypes: true });
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(folder.path, file.name);
|
||||
const filePath = path.join(file.path, file.name || '');
|
||||
if (file.isFile() && await isPlainTextFile(filePath)) {
|
||||
console.log(`Add ${file.name} in ${folder.path} for indexing`);
|
||||
console.log(`Add ${file.name} in ${file.path} for indexing`);
|
||||
filesToPush.push(filePath);
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
await processDirectory(filesToPush, {'path': path.join(folder.path, file.name)});
|
||||
await processDirectory(filesToPush, {'path': filePath});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -497,11 +497,11 @@ app.whenReady().then(() => {
|
||||
try {
|
||||
const result = await todesktop.autoUpdater.checkForUpdates();
|
||||
if (result.updateInfo) {
|
||||
console.log("Update found:", result.updateInfo.version);
|
||||
console.log("Desktop app update found:", result.updateInfo.version);
|
||||
todesktop.autoUpdater.restartAndInstall();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Update check failed:", e);
|
||||
console.warn("Desktop app update check failed:", e);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"axios": "^1.6.4",
|
||||
"cron": "^2.4.3",
|
||||
"electron-store": "^8.1.0",
|
||||
"fs": "^0.0.1-security",
|
||||
"file-type": "^16.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,11 +536,6 @@ fs.realpath@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
||||
|
||||
fs@^0.0.1-security:
|
||||
version "0.0.1-security"
|
||||
resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4"
|
||||
integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==
|
||||
|
||||
function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
|
||||
Reference in New Issue
Block a user