From be3d480e2f5f4917e2d3e333512e0d2a6ea40d34 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Sun, 1 Jun 2025 14:52:03 -0500 Subject: [PATCH] fix issue with files loading with watching enabled --- server/models/documentSyncQueue.js | 2 ++ server/utils/files/index.js | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/models/documentSyncQueue.js b/server/models/documentSyncQueue.js index 4c5ee71afee..b4e9790ce1c 100644 --- a/server/models/documentSyncQueue.js +++ b/server/models/documentSyncQueue.js @@ -53,6 +53,8 @@ const DocumentSyncQueue = { * @returns {boolean} - true if the document can be watched, false otherwise */ canWatch: function ({ title, chunkSource = null } = {}) { + if (!chunkSource) return false; + if (chunkSource.startsWith("link://") && title.endsWith(".html")) return true; // If is web-link material (prior to feature most chunkSources were links://) if (chunkSource.startsWith("youtube://")) return true; // If is a youtube link diff --git a/server/utils/files/index.js b/server/utils/files/index.js index 3f186f356fe..47c358d40c3 100644 --- a/server/utils/files/index.js +++ b/server/utils/files/index.js @@ -361,9 +361,6 @@ async function fileToPickerData({ const filename = path.basename(pathToFile); const fileStats = fs.statSync(pathToFile); const cachedStatus = await cachedVectorInformation(cachefilename, true); - const canWatchStatus = liveSyncAvailable - ? DocumentSyncQueue.canWatch(metadata) - : false; if (fileStats.size < FILE_READ_SIZE_THRESHOLD) { const rawData = fs.readFileSync(pathToFile, "utf8"); @@ -381,7 +378,9 @@ async function fileToPickerData({ type: "file", ...metadata, cached: cachedStatus, - canWatch: canWatchStatus, + canWatch: liveSyncAvailable + ? DocumentSyncQueue.canWatch(metadata) + : false, // pinnedWorkspaces: [], // This is the list of workspaceIds that have pinned this document // watched: false, // boolean to indicate if this document is watched in ANY workspace }; @@ -429,7 +428,7 @@ async function fileToPickerData({ type: "file", ...metadata, cached: cachedStatus, - canWatch: canWatchStatus, + canWatch: liveSyncAvailable ? DocumentSyncQueue.canWatch(metadata) : false, }; }