Skip to content

Commit

Permalink
Fix bug with Google Drive shortcut error case
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Nov 21, 2023
1 parent d6a84ab commit eeb844e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions backend/danswer/connectors/google_drive/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,27 @@ def _run_drive_file_query(
for file in files:
if follow_shortcuts and "shortcutDetails" in file:
try:
file = service.files().get(
fileId=file["shortcutDetails"]["targetId"],
supportsAllDrives=include_shared,
fields="mimeType, id, name, modifiedTime, webViewLink, shortcutDetails",
)
file = add_retries(lambda: file.execute())()
file_shortcut_points_to = add_retries(
lambda: (
service.files()
.get(
fileId=file["shortcutDetails"]["targetId"],
supportsAllDrives=include_shared,
fields="mimeType, id, name, modifiedTime, webViewLink, shortcutDetails",
)
.execute()
)
)()
yield file_shortcut_points_to
except HttpError:
logger.error(
f"Failed to follow shortcut with details: {file['shortcutDetails']}"
)
if continue_on_failure:
continue
raise
yield file
else:
yield file


def _get_folder_id(
Expand Down

1 comment on commit eeb844e

@vercel
Copy link

@vercel vercel bot commented on eeb844e Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.