mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Skip trying to index deleted files, folders from Desktop app
Previously app would crash on startup if desktop app was told to index a file that had been deleted afterwards
This commit is contained in:
@@ -170,11 +170,21 @@ function pushDataToKhoj (regenerate = false) {
|
|||||||
|
|
||||||
// Collect paths of all configured files to index
|
// Collect paths of all configured files to index
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
|
// Remove files that no longer exist
|
||||||
|
if (!fs.existsSync(file.path)) {
|
||||||
|
console.error(`${file.path} does not exist`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
filesToPush.push(file.path);
|
filesToPush.push(file.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect paths of all indexable files in configured folders
|
// Collect paths of all indexable files in configured folders
|
||||||
for (const folder of folders) {
|
for (const folder of folders) {
|
||||||
|
// Remove folders that no longer exist
|
||||||
|
if (!fs.existsSync(folder.path)) {
|
||||||
|
console.error(`${folder.path} does not exist`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
processDirectory(filesToPush, folder);
|
processDirectory(filesToPush, folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user