Summary
gog drive delete claims to move files to trash (as stated in its help text: "Delete a file (moves to trash)"), but actually permanently deletes files by calling the Google Drive API's files.delete endpoint, which is irreversible.
Expected Behavior
gog drive delete <fileId> should move the file to the trash (recoverable for 30 days), consistent with:
- The help text description
- Google Drive web UI behavior when pressing "Delete"
- User expectations for a safe default
Actual Behavior
The command calls svc.Files.Delete(fileID) (drive.go#L557), which is the Google Drive API's permanent delete. Files are immediately and irreversibly destroyed — they do not appear in the trash.
Steps to Reproduce
# Upload a test file
gog drive upload test.txt --account user@example.com
# Delete it (expecting trash)
gog drive delete <fileId> --force --account user@example.com
# Check trash — file is NOT there, it's gone forever
# The file also returns 404 from the API
gog drive get <fileId> --account user@example.com
# → Google API error (404 notFound): File not found
Suggested Fix
- Default
drive delete should use Files.Update with Trashed: true to move to trash
- Add a
--permanent flag for users who explicitly want irreversible deletion
- The permanent delete path should keep using
Files.Delete
// Trash (default, safe)
svc.Files.Update(fileID, &drive.File{Trashed: true}).SupportsAllDrives(true).Context(ctx).Do()
// Permanent delete (opt-in with --permanent)
svc.Files.Delete(fileID).SupportsAllDrives(true).Context(ctx).Do()
Impact
This is a data loss bug. Users who rely on the documented "moves to trash" behavior cannot recover their files. The 30-day trash recovery window that Google Drive provides is completely bypassed.
Environment
- gogcli version: v0.10.0
- OS: macOS
Summary
gog drive deleteclaims to move files to trash (as stated in its help text:"Delete a file (moves to trash)"), but actually permanently deletes files by calling the Google Drive API'sfiles.deleteendpoint, which is irreversible.Expected Behavior
gog drive delete <fileId>should move the file to the trash (recoverable for 30 days), consistent with:Actual Behavior
The command calls
svc.Files.Delete(fileID)(drive.go#L557), which is the Google Drive API's permanent delete. Files are immediately and irreversibly destroyed — they do not appear in the trash.Steps to Reproduce
Suggested Fix
drive deleteshould useFiles.UpdatewithTrashed: trueto move to trash--permanentflag for users who explicitly want irreversible deletionFiles.DeleteImpact
This is a data loss bug. Users who rely on the documented "moves to trash" behavior cannot recover their files. The 30-day trash recovery window that Google Drive provides is completely bypassed.
Environment