Skip to content

Bug in GDrive Connector: Subfolders not synced #70

Description

@MoeLa

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

  1. Create a Google Drive folder with at least one subfolder containing files
  2. Configure the GDrive connector pointing to the root folder
  3. Run oikb sync
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions