From 9efd4455592a2fc0cdbd6fd6f347ca5fdffff14d Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Fri, 12 Dec 2025 12:58:32 -0300 Subject: [PATCH] removed sanitizer --- src/tui/managers/env_manager.py | 18 ++++++------------ src/tui/utils/validation.py | 15 --------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/tui/managers/env_manager.py b/src/tui/managers/env_manager.py index 0b556a85..4f5ee461 100644 --- a/src/tui/managers/env_manager.py +++ b/src/tui/managers/env_manager.py @@ -12,7 +12,6 @@ from dotenv import load_dotenv from utils.logging_config import get_logger from ..utils.validation import ( - sanitize_env_value, validate_documents_paths, validate_google_oauth_client_id, validate_non_empty, @@ -548,17 +547,12 @@ class EnvManager: # Check if OPENRAG_VERSION is already set in .env if self.env_file.exists(): - env_content = self.env_file.read_text() - if "OPENRAG_VERSION" in env_content: - # Already set, check if it needs updating - for line in env_content.splitlines(): - if line.strip().startswith("OPENRAG_VERSION"): - existing_value = line.split("=", 1)[1].strip() - existing_value = sanitize_env_value(existing_value) - if existing_value == current_version: - # Already correct, no update needed - return - break + # Load .env file using load_dotenv + load_dotenv(dotenv_path=self.env_file, override=False) + existing_value = os.environ.get("OPENRAG_VERSION", "") + if existing_value and existing_value == current_version: + # Already correct, no update needed + return # Set or update OPENRAG_VERSION self.config.openrag_version = current_version diff --git a/src/tui/utils/validation.py b/src/tui/utils/validation.py index c91c4f00..cdbeb810 100644 --- a/src/tui/utils/validation.py +++ b/src/tui/utils/validation.py @@ -96,21 +96,6 @@ def validate_non_empty(value: str) -> bool: return bool(value and value.strip()) -def sanitize_env_value(value: str) -> str: - """Sanitize environment variable value.""" - # Remove leading/trailing whitespace - value = value.strip() - - # Remove quotes if they wrap the entire value - if len(value) >= 2: - if (value.startswith('"') and value.endswith('"')) or ( - value.startswith("'") and value.endswith("'") - ): - value = value[1:-1] - - return value - - def validate_documents_paths(paths_str: str) -> tuple[bool, str, list[str]]: """ Validate comma-separated documents paths for volume mounting.