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 2 commits 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThree Google Drive proxy route handlers ( ChangesGoogle Drive Shared-Drive Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 | 1e42577 | Jun 18 2026, 07:38 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}` }, | ||
| }); |
|
@claude Please remediate the open review findings on this PR (fix/gdrive-shared-drive-params) so it becomes merge-ready. All are in src/api/routes/google.js and its tests:
Constraints: tests must exercise real behavior (no new DB/service mocks per repo rules). Run |
|
Claude finished @chitcommit's task in 4m 29s —— View job Review findings remediatedAll four Copilot review findings have been addressed in commit
What changed
|
Addresses all four review findings from Copilot: 1. Clarifies the files.list comment — notes that includeItemsFromAllDrives and corpora are list-only; supportsAllDrives is set separately on the files.get and content routes. 2. Asserts supportsAllDrives, includeItemsFromAllDrives, and corpora are always present on the upstream files.list URL. 3. Asserts supportsAllDrives=true is present on the upstream files.get URL. 4. Asserts supportsAllDrives=true is present on the metadata prefetch and on both the export and alt=media download URLs in the content route. Co-authored-by: @chitcommit <chitcommit@users.noreply.github.com>
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
Summary by CodeRabbit
New Features
Tests