Description
The Google Drive connector only syncs files from the root folder. All subfolders and their contents are ignored. Additionally, if a previous sync had already ingested files from subfolders (e.g. via manual upload), a subsequent connector sync deletes those entries from the Knowledge Base, because the manifest no longer contains them.
Root Cause
application/vnd.google-apps.folder is listed in _SKIP_MIMES, which causes the early continue in _walk_folder to fire before the recursive branch is ever reached:
_SKIP_MIMES = frozenset({
"application/vnd.google-apps.folder", # <-- skips folders before recursion
"application/vnd.google-apps.form",
...
})
def _walk_folder(self, ...):
for item in resp.get("files", []):
mime = item["mimeType"]
if mime in _SKIP_MIMES: # folder hits this first
continue
if mime == "application/vnd.google-apps.folder": # dead code
self._walk_folder(...) # never reached
continue
The recursive subfolder handling is effectively dead code.
Fix
Remove application/vnd.google-apps.folder from _SKIP_MIMES so the dedicated recursion branch is reached:
_SKIP_MIMES = frozenset({
# "application/vnd.google-apps.folder", # handled separately below
"application/vnd.google-apps.form",
"application/vnd.google-apps.map",
"application/vnd.google-apps.site",
"application/vnd.google-apps.shortcut",
})
Steps to Reproduce
- Create a Google Drive folder with at least one subfolder containing files
- Configure the GDrive connector pointing to the root folder
- Run
oikb sync
- Observe that only files in the root are synced; subfolder contents are absent from the manifest
Impact
- Subfolder contents are never synced
- Previously ingested subfolder files are deleted from the Knowledge Base on the next sync run, because the manifest shrinks
Description
The Google Drive connector only syncs files from the root folder. All subfolders and their contents are ignored. Additionally, if a previous sync had already ingested files from subfolders (e.g. via manual upload), a subsequent connector sync deletes those entries from the Knowledge Base, because the manifest no longer contains them.
Root Cause
application/vnd.google-apps.folderis listed in_SKIP_MIMES, which causes the earlycontinuein_walk_folderto fire before the recursive branch is ever reached:The recursive subfolder handling is effectively dead code.
Fix
Remove
application/vnd.google-apps.folderfrom_SKIP_MIMESso the dedicated recursion branch is reached:Steps to Reproduce
oikb syncImpact