Fix service accounts + shared drives (#490)

This commit is contained in:
Chris Weaver 2023-09-29 17:26:42 -07:00 committed by GitHub
parent bfab9d1ee7
commit 0c6077ee7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -75,6 +75,7 @@ def _run_drive_file_query(
results = (
service.files()
.list(
corpora="allDrives", # needed to search through shared drives
pageSize=batch_size,
supportsAllDrives=include_shared,
includeItemsFromAllDrives=include_shared,
@ -124,6 +125,7 @@ def _get_folder_id(
else:
query += f"mimeType='{DRIVE_FOLDER_TYPE}'"
# TODO: support specifying folder path in shared drive rather than just `My Drive`
results = (
service.files()
.list(
@ -248,7 +250,7 @@ def get_all_files_batched(
),
)
if traverse_subfolders:
if traverse_subfolders and folder_id is not None:
folder_ids_traversed = folder_ids_traversed or []
subfolders = _get_folders(
service=service,

View File

@ -203,9 +203,9 @@ const GoogleDriveConnectorManagement = ({
})(values)}
<BooleanFormField
name="include_shared"
label="Include Shared Files"
label="Include Shared Files + Shared Drives"
subtext={
"If checked, then we will also index all documents shared with you. " +
"If checked, then we will also index all documents + drives shared with you. " +
"If this is combined with folder paths, then we will only index documents " +
"that match both criteria."
}