fix(drive): include driveId in field masks for list/search/get#524
Open
LeanSheng wants to merge 1 commit intosteipete:mainfrom
Open
fix(drive): include driveId in field masks for list/search/get#524LeanSheng wants to merge 1 commit intosteipete:mainfrom
LeanSheng wants to merge 1 commit intosteipete:mainfrom
Conversation
The Drive API only returns fields explicitly requested in the fields parameter. The previous masks in drive_listing.go (driveFileListFields) and drive.go (DriveGetCmd) omitted driveId, so JSON output for drive search, drive ls, and drive get never included driveId — even when files lived in a Shared Drive. This made it impossible to distinguish My Drive files from Shared Drive files in gog output. For users whose work lives primarily in Shared Drives (common for legal, M&A, and agency deployments), the agent could not answer 'which drive is this file in?' from gog output alone, falling back to a raw Drive API call. The fix adds driveId to both field masks. For My Drive files the Drive API omits the field from responses, so existing downstream consumers are unaffected. Shared drive files now carry the correct driveId through to gog output. Adds a small regression test pinning driveId in the shared field mask constant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
driveIdto the shared field mask indriveFileListFields(drivesdrive ls,drive search) and to the inlineFields(...)call inDriveGetCmd.Run(drive get).fields; withdriveIdomitted, JSON output never included it even for files living in a Shared Drive, making it impossible to distinguish My Drive vs. Shared Drive files fromgogoutput alone.driveIdthrough.internal/cmd/drive_driveid_field_test.gopinningdriveIdin the shared mask constant.Test plan
go build ./...go vet ./...go test ./internal/cmd/... -count=1 -timeout 60sgo test ./internal/cmd/... -run TestDriveFileListFields -count=1 -v(new test passes)gog drive ls --all-drives --format=jsonon an account with Shared Drive access showsdriveIdfor Shared Drive files and omits it for My Drive filesgog drive get <sharedDriveFileId> --format=jsonincludesdriveId