Skip to content

Commit

Permalink
fix: handle 403 error for OneDrive document accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
milovate committed Jan 23, 2025
1 parent 604ce08 commit a5df6c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion daras_ai_v2/onedrive_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def onedrive_meta(

return metadata
except requests.exceptions.HTTPError as e:
if e.status_code == 401 and retries > 0:
if r.status_code == 401 and retries > 0:
try:
current_workspace.onedrive_access_token = (
get_access_token_from_refresh_token(
Expand All @@ -78,5 +78,10 @@ def onedrive_meta(
)
except Exception:
raise OneDriveAuth(generate_onedrive_auth_url(current_app_url))

elif r.status_code == 403:
raise UserError(
"make sure the document is accessible from loggedin microsoft account"
)
else:
raise e

0 comments on commit a5df6c0

Please sign in to comment.