fix: check if key present in settings before updating (#2306)

This commit is contained in:
Vlad Stan 2024-03-12 15:03:11 +02:00 committed by GitHub
parent 4c0bd132b1
commit 5b4398911a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -709,11 +709,14 @@ async def check_webpush_settings():
def update_cached_settings(sets_dict: dict):
for key, value in sets_dict.items():
if key not in readonly_variables:
try:
setattr(settings, key, value)
except Exception:
logger.warning(f"Failed overriding setting: {key}, value: {value}")
if key in readonly_variables:
continue
if key not in settings.dict().keys():
continue
try:
setattr(settings, key, value)
except Exception:
logger.warning(f"Failed overriding setting: {key}, value: {value}")
if "super_user" in sets_dict:
setattr(settings, "super_user", sets_dict["super_user"])