Bug Report: gog drive delete fails with 404 on Shared Drive files
Environment
- gog version: v0.9.0
- Platform: Debian 12 (Linux)
- Google Account type: Google Workspace (with Shared Drives)
Description
gog drive delete <fileId> fails with a 404 error when deleting files from Google Shared Drives, even when the user has fileOrganizer (Content Manager) permissions which include delete rights.
Root Cause
The Google Drive API requires the supportsAllDrives=true query parameter for all operations on Shared Drive files. The gog drive delete command does not set this parameter, causing the API to only search in the user's personal "My Drive" and return a 404 error when the file exists only in a Shared Drive.
Steps to Reproduce
- Set up a Google Shared Drive with a test account having "Content Manager" role (fileOrganizer)
- Upload a file to the Shared Drive root:
gog drive upload test.txt --shared-drive "MySharedDrive" --account user@example.com
- Note the returned file ID (e.g.,
1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia)
- Verify the file exists:
gog drive get 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --account user@example.com --shared-drive "MySharedDrive"
# Returns: file metadata successfully
- Try to delete it:
gog drive delete 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --account user@example.com --shared-drive "MySharedDrive" --force
Expected Behavior
File should be moved to trash (or permanently deleted if --permanent flag exists).
Actual Behavior
Google API error (404 notFound): File not found: 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia.
Verification
The file DOES exist - confirmed via:
gog drive get <fileId> returns full metadata
- Google Drive web UI shows the file
gog drive permissions <fileId> shows user has fileOrganizer role
Workaround
Move the file to personal "My Drive" first, then delete:
# Move to My Drive (parentId: null = root of My Drive)
gog drive move 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --parent <myDriveRootId> --account user@example.com
# Delete from My Drive (works without supportsAllDrives)
gog drive delete 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --account user@example.com --force
Fix Needed
The delete command should add supportsAllDrives=true query parameter when making the API call, similar to how other commands (upload, move, etc.) handle Shared Drives.
API Documentation:
https://developers.google.com/drive/api/guides/enable-shareddrives#make_an_api_request
Relevant excerpt:
To access shared drives using the Drive API, add the supportsAllDrives=true query parameter to all requests to the Drive API that include a file ID parameter.
Additional Context
Other gog drive commands correctly work with Shared Drives when --shared-drive flag is used:
- ✅
gog drive upload - works
- ✅
gog drive move - works
- ✅
gog drive rename - works
- ✅
gog drive copy - works
- ✅
gog drive get - works
- ❌
gog drive delete - fails with 404
This suggests the delete command is missing the supportsAllDrives=true parameter that other commands include.
Bug Report:
gog drive deletefails with 404 on Shared Drive filesEnvironment
Description
gog drive delete <fileId>fails with a 404 error when deleting files from Google Shared Drives, even when the user hasfileOrganizer(Content Manager) permissions which include delete rights.Root Cause
The Google Drive API requires the
supportsAllDrives=truequery parameter for all operations on Shared Drive files. Thegog drive deletecommand does not set this parameter, causing the API to only search in the user's personal "My Drive" and return a 404 error when the file exists only in a Shared Drive.Steps to Reproduce
gog drive upload test.txt --shared-drive "MySharedDrive" --account user@example.com1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia)gog drive delete 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --account user@example.com --shared-drive "MySharedDrive" --forceExpected Behavior
File should be moved to trash (or permanently deleted if
--permanentflag exists).Actual Behavior
Verification
The file DOES exist - confirmed via:
gog drive get <fileId>returns full metadatagog drive permissions <fileId>shows user hasfileOrganizerroleWorkaround
Move the file to personal "My Drive" first, then delete:
Fix Needed
The
deletecommand should addsupportsAllDrives=truequery parameter when making the API call, similar to how other commands (upload, move, etc.) handle Shared Drives.API Documentation:
https://developers.google.com/drive/api/guides/enable-shareddrives#make_an_api_request
Relevant excerpt:
Additional Context
Other
gog drivecommands correctly work with Shared Drives when--shared-driveflag is used:gog drive upload- worksgog drive move- worksgog drive rename- worksgog drive copy- worksgog drive get- worksgog drive delete- fails with 404This suggests the delete command is missing the
supportsAllDrives=trueparameter that other commands include.