diff --git a/.changeset/fix-722-drive-upload-shared-drives.md b/.changeset/fix-722-drive-upload-shared-drives.md new file mode 100644 index 00000000..78fe5711 --- /dev/null +++ b/.changeset/fix-722-drive-upload-shared-drives.md @@ -0,0 +1,5 @@ +--- +"@googleworkspace/cli": patch +--- + +`drive +upload`: pass `supportsAllDrives=true` on every upload request so files can be placed inside Shared Drive folders via `--parent`. Previously, any `--parent` pointing to a Shared Drive folder was rejected by the API with a 404 or permission error even when the user had access. diff --git a/crates/google-workspace-cli/src/helpers/drive.rs b/crates/google-workspace-cli/src/helpers/drive.rs index 68662ec6..d55a6931 100644 --- a/crates/google-workspace-cli/src/helpers/drive.rs +++ b/crates/google-workspace-cli/src/helpers/drive.rs @@ -56,11 +56,13 @@ impl Helper for DriveHelper { EXAMPLES: gws drive +upload ./report.pdf gws drive +upload ./report.pdf --parent FOLDER_ID + gws drive +upload ./report.pdf --parent SHARED_DRIVE_FOLDER_ID gws drive +upload ./data.csv --name 'Sales Data.csv' TIPS: MIME type is detected automatically. - Filename is inferred from the local path unless --name is given.", + Filename is inferred from the local path unless --name is given. + Shared Drive folders are supported: pass the folder ID via --parent.", ), ); cmd @@ -105,7 +107,7 @@ TIPS: executor::execute_method( doc, create_method, - None, + Some(r#"{"supportsAllDrives": true}"#), Some(&body_str), token.as_deref(), auth_method,