From 4136033bf0e580cbabe811084ab47ea0d6af8f9a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 20:24:35 +0000 Subject: [PATCH] fix(api): track env_file_written accurately in save_google_drive_settings Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/df99f308-d964-4732-88b7-a01be6aeee05 --- app/api/google_drive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/google_drive.py b/app/api/google_drive.py index 60a55060..e2b17fdc 100644 --- a/app/api/google_drive.py +++ b/app/api/google_drive.py @@ -415,10 +415,9 @@ async def save_google_drive_settings( drive_settings["GOOGLE_DRIVE_FOLDER_ID"] = folder_id # Best-effort .env file write — failures here are non-fatal - env_file_exists = False + env_file_written = False try: - env_file_exists = os.path.exists(env_path) - if env_file_exists: + if os.path.exists(env_path): logger.info(f"Updating Google Drive settings in {env_path}") # Read the current .env file @@ -451,6 +450,7 @@ async def save_google_drive_settings( f.write("\n".join(new_env_lines) + "\n") logger.info("Successfully updated Google Drive settings in .env file") + env_file_written = True else: logger.warning( f".env file not found at {env_path}, skipping file update but continuing with in-memory update" @@ -494,7 +494,7 @@ async def save_google_drive_settings( return { "status": "success", "message": "Google Drive settings have been saved", - "in_memory_only": not env_file_exists, + "in_memory_only": not env_file_written, } except Exception as e: