Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoogleDrive: fix error in file-upload command #33290

Merged
merged 4 commits into from Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Packs/GoogleDrive/Integrations/GoogleDrive/GoogleDrive.py
Expand Up @@ -1230,6 +1230,8 @@ def file_upload_command(client: 'GSuiteClient', args: dict[str, str]) -> Command
file_path = demisto.getFilePath(file_entry_id)

user_id = args.get('user_id') or client.user_id
supports_all_drives = argToBoolean(args.get('supports_all_drives', False))

client.set_authorized_http(scopes=COMMAND_SCOPES['FILES'], subject=user_id)
drive_service = discovery.build(serviceName=SERVICE_NAME, version=API_VERSION, http=client.authorized_http)
body: dict[str, str] = assign_params(
Expand All @@ -1242,6 +1244,7 @@ def file_upload_command(client: 'GSuiteClient', args: dict[str, str]) -> Command
media = MediaFileUpload(file_path['path'])
file = drive_service.files().create(body=body,
media_body=media,
supportsAllDrives=supports_all_drives,
fields='*'
).execute()
return handle_response_file_single(file, args)
Expand Down
9 changes: 8 additions & 1 deletion Packs/GoogleDrive/Integrations/GoogleDrive/GoogleDrive.yml
Expand Up @@ -2115,6 +2115,13 @@ script:
description: The file's Entry ID.
- name: parent
description: The ID of the parent folder which contains the file. If not specified as part of a create request, the file will be placed directly in the user's My Drive folder.
- auto: PREDEFINED
defaultValue: "false"
description: 'Whether the requesting application supports both My Drives and shared drives.'
name: supports_all_drives
predefined:
- "true"
- "false"
outputs:
- contextPath: GoogleDrive.File.File.id
description: The ID of the file.
Expand Down Expand Up @@ -3103,7 +3110,7 @@ script:
- contextPath: GoogleDrive.File.Parents
description: The IDs of the parent folders which contain the file.
type: String
dockerimage: demisto/googleapi-python3:1.0.0.89217
dockerimage: demisto/googleapi-python3:1.0.0.89487
isfetch: true
runonce: false
script: "-"
Expand Down
1 change: 1 addition & 0 deletions Packs/GoogleDrive/Integrations/GoogleDrive/README.md
Expand Up @@ -820,6 +820,7 @@ Creates a new file.
| file_name | The name of the file to upload. | Optional |
| entry_id | The file's Entry ID. | Optional |
| parent | The ID of the parent folder which contains the file. If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. | Optional |
| supports_all_drives | Whether the requesting application supports both My Drives and shared drives. Possible values: "true" and "false". Default is "false". | Optional |

#### Context Output

Expand Down
7 changes: 7 additions & 0 deletions Packs/GoogleDrive/ReleaseNotes/1_3_5.md
@@ -0,0 +1,7 @@

#### Integrations

##### Google Drive

- Fixed an issue where **google-drive-file-upload** command failed to upload file to a shared drive.
- Updated the Docker image to: *demisto/googleapi-python3:1.0.0.89487*.
2 changes: 1 addition & 1 deletion Packs/GoogleDrive/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Google Drive",
"description": "Google Drive allows users to store files on their servers, synchronize files across devices, and share files. This integration helps you to create a new drive, query past activity and view change logs performed by the users, as well as list drives and files, and manage their permissions.",
"support": "xsoar",
"currentVersion": "1.3.4",
"currentVersion": "1.3.5",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down