mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Made safer database metadata retrieval in Database.py
This commit is contained in:
parent
b2deea3aa3
commit
c7bf53ba90
1 changed files with 2 additions and 2 deletions
|
|
@ -319,9 +319,9 @@ class Database:
|
|||
"last_pro_check": None,
|
||||
"default": True,
|
||||
}
|
||||
database = self.database_uri.split(":")[0].split("+")[0]
|
||||
with self.__db_session() as session:
|
||||
try:
|
||||
database = self.database_uri.split(":")[0].split("+")[0]
|
||||
data["database_version"] = (
|
||||
session.execute(text("SELECT sqlite_version()" if database == "sqlite" else "SELECT VERSION()")).first() or ["unknown"]
|
||||
)[0]
|
||||
|
|
@ -354,7 +354,7 @@ class Database:
|
|||
"default": False,
|
||||
}
|
||||
)
|
||||
except (ProgrammingError, OperationalError):
|
||||
except BaseException:
|
||||
self.logger.debug(f"Can't get the metadata: {format_exc()}")
|
||||
|
||||
return data
|
||||
|
|
|
|||
Loading…
Reference in a new issue