fix(google): shared-drive params on Drive v3 proxy (Bug 2)#251
fix(google): shared-drive params on Drive v3 proxy (Bug 2)#251chitcommit wants to merge 1 commit into
Conversation
The Google Drive proxy omitted `supportsAllDrives` on all file get/export/ download calls and the shared-drive corpora params on list, so files living in a shared drive 404'd even with a valid delegated token whose impersonated user is a member of that drive. Changes (src/api/routes/google.js): - GET /gdrive/files (list): add supportsAllDrives=true, includeItemsFromAllDrives=true, corpora=allDrives - GET /gdrive/files/:fileId (metadata): add supportsAllDrives=true - GET /gdrive/files/:fileId/content: add supportsAllDrives=true to the metadata pre-fetch, the Google-native export URL, and the alt=media download URL Proven against ground-truth file 1pfPB3gq_l2LUWW29k3hadCi0q5F507-i (1.84MB PDF in the "Arias V Bianchi" shared drive, driveId 0AHH7mqSeNtbbUk9PVA), fetched with a delegated SA token (sub=nick@jeanarlene.com, drive scope): files.get?fields=mimeType -> 404 File not found files.get?fields=mimeType&supportsAllDrives=true -> 200 files.list (shared corpora params) -> 200 (lists drive contents) The content route fetches metadata FIRST, so the metadata 404 is what broke the whole download flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 11 minutes and 35 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
chittyconnect | 585bee4 | Jun 14 2026, 11:27 AM |
There was a problem hiding this comment.
Pull request overview
Fixes Google Drive v3 proxy behavior for files stored in shared drives by ensuring the required shared-drive query parameters are included on list/get/download flows.
Changes:
- Add shared-drive list parameters (
supportsAllDrives,includeItemsFromAllDrives,corpora=allDrives) toGET /gdrive/files. - Add
supportsAllDrives=truetoGET /gdrive/files/:fileIdmetadata requests. - Add
supportsAllDrives=trueto the content route’s metadata prefetch and to both export andalt=mediadownload URLs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Shared-drive support: without these, files living in shared drives are | ||
| // invisible to list/get even when the delegated user is a member. |
| params.set("supportsAllDrives", "true"); | ||
| params.set("includeItemsFromAllDrives", "true"); | ||
| params.set("corpora", "allDrives"); |
| // Shared-drive support — required for files that live in a shared drive. | ||
| params.set("supportsAllDrives", "true"); |
| const metadataResponse = await fetch(`${DRIVE_API}/files/${encodedFileId}?fields=mimeType&supportsAllDrives=true`, { | ||
| headers: { Authorization: `Bearer ${token}` }, | ||
| }); |
Bug 2 — Drive proxy omits shared-drive params
The Google Drive proxy (
src/api/routes/google.js) never setsupportsAllDrives=trueon any Drive v3 get/export/download call, nor the shared-drive corpora params on list. Files living in a shared drive therefore 404 even with a valid delegated token whose impersonated user is a member of that drive.Changes
GET /gdrive/files(list):supportsAllDrives=true,includeItemsFromAllDrives=true,corpora=allDrivesGET /gdrive/files/:fileId(metadata):supportsAllDrives=trueGET /gdrive/files/:fileId/content:supportsAllDrives=trueon the metadata pre-fetch, the Google-native export URL, and thealt=mediadownload URLThe content route fetches metadata first, so the metadata 404 is what broke the entire download flow.
Verification (ground truth)
File
1pfPB3gq_l2LUWW29k3hadCi0q5F507-i— a 1.84 MB PDF in the "Arias V Bianchi" shared drive (driveId 0AHH7mqSeNtbbUk9PVA). Fetched directly against the Drive v3 API with a delegated service-account token (sub=nick@jeanarlene.com, scopedrive), mirroring the prod rotation path exactly:files.get?fields=mimeType(no param)files.get?fields=mimeType&supportsAllDrives=truefiles.get?alt=media&supportsAllDrives=true(content)files.listwith shared-drive corpora paramsGAM fetches the same file as ground truth, confirming the delegated subject is a member of the shared drive.
Deploy gate
Do NOT auto-merge. Operator approves prod deploys of new code. This PR is the code half of the shared-drive fix; the credential half (Bug 1, augmented SA JSON in
CREDENTIAL_CACHEKV) has already been provisioned out-of-band.🤖 Generated with Claude Code