Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Fixed

- **Google Drive**: sync now works for folders inside a Shared Drive (formerly Team Drive). The Drive API `files.list` calls were missing `supportsAllDrives` and `includeItemsFromAllDrives`, so Shared Drive contents were invisible and the sync reported "nothing to do". File downloads/exports now pass `supportsAllDrives` as well.

## [0.3.6] - 2026-05-28

### Added
Expand Down
24 changes: 21 additions & 3 deletions src/oikb/connectors/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def _walk_folder(
fields="nextPageToken, files(id, name, mimeType, md5Checksum, modifiedTime, size)",
pageSize=1000,
pageToken=page_token,
supportsAllDrives=True,
includeItemsFromAllDrives=True,
)
.execute()
)
Expand Down Expand Up @@ -140,14 +142,26 @@ def read_file(self, path: str, filename: str) -> bytes:
raise FileNotFoundError(f"File not found in Drive: {path}/{filename}")

# Check if it needs export.
meta = self._service.files().get(fileId=file_id, fields="mimeType").execute()
meta = (
self._service.files()
.get(fileId=file_id, fields="mimeType", supportsAllDrives=True)
.execute()
)
mime = meta["mimeType"]

if mime in _EXPORT_MIMES:
export_mime, _ = _EXPORT_MIMES[mime]
return self._service.files().export(fileId=file_id, mimeType=export_mime).execute()
return (
self._service.files()
.export(fileId=file_id, mimeType=export_mime)
.execute()
)

return self._service.files().get_media(fileId=file_id).execute()
return (
self._service.files()
.get_media(fileId=file_id, supportsAllDrives=True)
.execute()
)

def _find_file(self, path: str, filename: str) -> str | None:
"""Find a file ID by navigating the folder path."""
Expand All @@ -168,6 +182,8 @@ def _find_file(self, path: str, filename: str) -> str | None:
.list(
q=f"'{current_folder}' in parents and name = '{segment}' and mimeType = 'application/vnd.google-apps.folder' and trashed = false",
fields="files(id)",
supportsAllDrives=True,
includeItemsFromAllDrives=True,
)
.execute()
)
Expand All @@ -182,6 +198,8 @@ def _find_file(self, path: str, filename: str) -> str | None:
.list(
q=f"'{current_folder}' in parents and name = '{search_name}' and trashed = false",
fields="files(id)",
supportsAllDrives=True,
includeItemsFromAllDrives=True,
)
.execute()
)
Expand Down