Skip to content

Bug: gog drive delete fails with 404 on Shared Drive files (missing supportsAllDrives=true) #217

@HendrikHarren

Description

@HendrikHarren

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

  1. Set up a Google Shared Drive with a test account having "Content Manager" role (fileOrganizer)
  2. Upload a file to the Shared Drive root:
    gog drive upload test.txt --shared-drive "MySharedDrive" --account user@example.com
  3. Note the returned file ID (e.g., 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia)
  4. Verify the file exists:
    gog drive get 1jGHQ8uydpRQrJHSgthRyz9_9fMeDHdia --account user@example.com --shared-drive "MySharedDrive"
    # Returns: file metadata successfully
  5. 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:

  1. gog drive get <fileId> returns full metadata
  2. Google Drive web UI shows the file
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions