修复 文件夹监控逻辑

This commit is contained in:
Chen committed 2025-12-02 23:58:06 +08:00
1 parent 3d62398a8e
commit 79816a7316
4 files changed
+97 -13

No files matched your search

+8
View File
@@ -35,6 +35,14 @@ function ensureFolderChain(db, folderPath) {
visited.add(current);
const parent = path.posix.dirname(current);
const name = current.split('/').pop();
// 安全检查:确保 db 对象有 getFolderByPath 方法
if (typeof db.getFolderByPath !== 'function') {
console.error('[ensureFolderChain] Error: db.getFolderByPath is not a function');
console.error('[ensureFolderChain] db object keys:', Object.keys(db));
return;
}
const existing = db.getFolderByPath(current);
if (!existing) {
db.insertFolder({