Problem
gog drive search does not return files that live exclusively on shared drives. The same files are accessible via gog drive get <fileId> and gog drive ls --parent <folderID>, and are searchable in the Google Drive web UI.
Root Cause
The drive search command sets IncludeItemsFromAllDrives(true) and SupportsAllDrives(true) on the API call, but does not set Corpora("allDrives"). Without the corpora parameter, the Google Drive API defaults to corpora=user, which only searches the user's My Drive.
Per the Google Drive API docs:
corpora — Bodies of items (files/documents) to which the query applies. Supported bodies are user, domain, drive, and allDrives. Prefer user or drive to allDrives for efficiency. By default, corpora is set to user.
Reproduction
# Account that ONLY has access via a shared drive (no personal files):
gog drive search "test" --account user@example.com
# → No results
# But direct access works:
gog drive get <fileId-from-shared-drive> --account user@example.com
# → Returns file metadata
# And listing by parent folder works:
gog drive ls --parent <shared-drive-folder-id> --account user@example.com
# → Returns files
Verification
A raw API call with corpora=allDrives using the same OAuth token returns results correctly:
curl "https://www.googleapis.com/drive/v3/files?q=fullText+contains+'test'&includeItemsFromAllDrives=true&supportsAllDrives=true&corpora=allDrives" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# → Returns shared drive files
Suggested Fix
Add .Corpora("allDrives") to the files.list call in the search command (and ideally drive ls as well). This could be:
- Always-on (safest default — matches web UI behavior), or
- Behind a flag like
--corpora allDrives or --include-shared-drives
Option 1 is simpler and matches user expectations since IncludeItemsFromAllDrives and SupportsAllDrives are already set.
Environment
- gog v0.9.0
- Google Workspace account with shared drive access
- macOS (Homebrew install)
Problem
gog drive searchdoes not return files that live exclusively on shared drives. The same files are accessible viagog drive get <fileId>andgog drive ls --parent <folderID>, and are searchable in the Google Drive web UI.Root Cause
The
drive searchcommand setsIncludeItemsFromAllDrives(true)andSupportsAllDrives(true)on the API call, but does not setCorpora("allDrives"). Without thecorporaparameter, the Google Drive API defaults tocorpora=user, which only searches the user's My Drive.Per the Google Drive API docs:
Reproduction
Verification
A raw API call with
corpora=allDrivesusing the same OAuth token returns results correctly:Suggested Fix
Add
.Corpora("allDrives")to thefiles.listcall in the search command (and ideallydrive lsas well). This could be:--corpora allDrivesor--include-shared-drivesOption 1 is simpler and matches user expectations since
IncludeItemsFromAllDrivesandSupportsAllDrivesare already set.Environment