diff --git a/backend/open_webui/internal/db.py b/backend/open_webui/internal/db.py index d4c25e459b..e3fbffcf23 100644 --- a/backend/open_webui/internal/db.py +++ b/backend/open_webui/internal/db.py @@ -90,8 +90,7 @@ if SQLALCHEMY_DATABASE_URL.startswith("sqlite+sqlcipher://"): # Extract database path from SQLCipher URL db_path = SQLALCHEMY_DATABASE_URL.replace("sqlite+sqlcipher://", "") - if db_path.startswith("/"): - db_path = db_path[1:] # Remove leading slash for relative paths + # Create a custom creator function that uses sqlcipher3 def create_sqlcipher_connection(): diff --git a/backend/open_webui/internal/wrappers.py b/backend/open_webui/internal/wrappers.py index b1b2a2ba23..e33bb3d3a4 100644 --- a/backend/open_webui/internal/wrappers.py +++ b/backend/open_webui/internal/wrappers.py @@ -54,8 +54,7 @@ def register_connection(db_url): # Parse the database path from SQLCipher URL # Convert sqlite+sqlcipher:///path/to/db.sqlite to /path/to/db.sqlite db_path = db_url.replace("sqlite+sqlcipher://", "") - if db_path.startswith("/"): - db_path = db_path[1:] # Remove leading slash for relative paths + # Use Peewee's native SqlCipherDatabase with encryption db = SqlCipherDatabase(db_path, passphrase=database_password)