Fix bug with Google Drive shortcut error case

This commit is contained in:
Weves 2023-11-20 16:26:42 -08:00 committed by Chris Weaver
parent d6a84ab413
commit eeb844e35e

View File

@ -101,12 +101,18 @@ def _run_drive_file_query(
for file in files: for file in files:
if follow_shortcuts and "shortcutDetails" in file: if follow_shortcuts and "shortcutDetails" in file:
try: try:
file = service.files().get( file_shortcut_points_to = add_retries(
fileId=file["shortcutDetails"]["targetId"], lambda: (
supportsAllDrives=include_shared, service.files()
fields="mimeType, id, name, modifiedTime, webViewLink, shortcutDetails", .get(
) fileId=file["shortcutDetails"]["targetId"],
file = add_retries(lambda: file.execute())() supportsAllDrives=include_shared,
fields="mimeType, id, name, modifiedTime, webViewLink, shortcutDetails",
)
.execute()
)
)()
yield file_shortcut_points_to
except HttpError: except HttpError:
logger.error( logger.error(
f"Failed to follow shortcut with details: {file['shortcutDetails']}" f"Failed to follow shortcut with details: {file['shortcutDetails']}"
@ -114,7 +120,8 @@ def _run_drive_file_query(
if continue_on_failure: if continue_on_failure:
continue continue
raise raise
yield file else:
yield file
def _get_folder_id( def _get_folder_id(