Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

chore(sync): mirror inkeep/open-knowledge#549: fix(server): include symbolic links in sync walker to prevent deletion (#2528)

inkeep-oss-sync[bot]8ac6e07c91be
diff --git a/.changeset/prevent-staging-symlink-deletion.md b/.changeset/prevent-staging-symlink-deletion.md
new file mode 100644
index 000000000..fae3d5ca9
--- /dev/null
+++ b/.changeset/prevent-staging-symlink-deletion.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Fixed symbolic links (mode `120000`) being automatically staged as deleted in the background Git sync loop. The filesystem scanner now correctly walks and includes symbolic links inside the content directory so they are recognized as on-disk files and are not incorrectly removed from Git tracking during sync commits.
diff --git a/packages/server/src/sync-engine.ts b/packages/server/src/sync-engine.ts
index dd4ad23fb..4fc85ebdb 100644
--- a/packages/server/src/sync-engine.ts
+++ b/packages/server/src/sync-engine.ts
@@ -1846,7 +1846,7 @@ export class SyncEngine {
if (!dirRelPath.startsWith('..') && this.contentFilter.isDirExcluded(dirRelPath))
continue;
walk(fullPath);
- } else if (entry.isFile()) {
+ } else if (entry.isFile() || entry.isSymbolicLink()) {
const contentRelPath = toPosix(relative(this.contentDir, fullPath));
// Only include files inside contentDir that pass the filter
if (!contentRelPath.startsWith('..') && !this.contentFilter.isExcluded(contentRelPath)) {