fix(tests): restore correct route URLs and fix auth/exception handling broken by d221753

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/df99f308-d964-4732-88b7-a01be6aeee05
This commit is contained in:
copilot-swe-agent[bot]
2026-03-24 20:22:18 +00:00
parent cafc0e4523
commit 48331f6e91
8 changed files with 55 additions and 36 deletions
+12 -10
View File
@@ -414,9 +414,11 @@ async def save_google_drive_settings(
if folder_id:
drive_settings["GOOGLE_DRIVE_FOLDER_ID"] = folder_id
# Try to update the .env file, but don't fail if it doesn't exist (for Docker containers)
if os.path.exists(env_path):
try:
# Best-effort .env file write — failures here are non-fatal
env_file_exists = False
try:
env_file_exists = os.path.exists(env_path)
if env_file_exists:
logger.info(f"Updating Google Drive settings in {env_path}")
# Read the current .env file
@@ -449,12 +451,12 @@ async def save_google_drive_settings(
f.write("\n".join(new_env_lines) + "\n")
logger.info("Successfully updated Google Drive settings in .env file")
except Exception as e:
logger.warning(f"Failed to update .env file: {str(e)}, but will continue with in-memory update")
else:
logger.warning(
f".env file not found at {env_path}, skipping file update but continuing with in-memory update"
)
else:
logger.warning(
f".env file not found at {env_path}, skipping file update but continuing with in-memory update"
)
except Exception as env_err:
logger.warning(f"Failed to write .env file (non-fatal): {env_err}")
# Update the settings in memory (this always happens)
if refresh_token:
@@ -492,7 +494,7 @@ async def save_google_drive_settings(
return {
"status": "success",
"message": "Google Drive settings have been saved",
"in_memory_only": not os.path.exists(env_path),
"in_memory_only": not env_file_exists,
}
except Exception as e: