From 6a80758c9b6241799d0fb2a16c61f4ea96fc465f Mon Sep 17 00:00:00 2001 From: tcely Date: Fri, 21 Feb 2025 12:07:32 -0500 Subject: [PATCH] Check for the database vendor first --- tubesync/sync/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 2a9ce8b5..1fa57f6c 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -90,10 +90,11 @@ class DashboardView(TemplateView): data['database_connection'] = settings.DATABASE_CONNECTION_STR # Add the database filesize when using db.sqlite3 data['database_filesize'] = None - db_name = str(connection.get_connection_params()['database']) - db_path = pathlib.Path(db_name) if '/' == db_name[0] else None - if db_path and 'sqlite' == connection.vendor: - data['database_filesize'] = db_path.stat().st_size + if 'sqlite' == connection.vendor: + db_name = str(connection.get_connection_params().get('database', '')) + db_path = pathlib.Path(db_name) if '/' == db_name[0] else None + if db_path: + data['database_filesize'] = db_path.stat().st_size return data