mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Better handling of super shitty edge case where an app settings.yml is empty for some unexpected mystic reason ...
This commit is contained in:
parent
8d1c75e732
commit
9eb123f8b1
1 changed files with 9 additions and 2 deletions
11
src/app.py
11
src/app.py
|
@ -1345,7 +1345,7 @@ def app_ssowatconf():
|
|||
|
||||
for app in _installed_apps():
|
||||
|
||||
app_settings = read_yaml(APPS_SETTING_PATH + app + "/settings.yml")
|
||||
app_settings = read_yaml(APPS_SETTING_PATH + app + "/settings.yml") or {}
|
||||
|
||||
# Redirected
|
||||
redirected_urls.update(app_settings.get("redirected_urls", {}))
|
||||
|
@ -1713,11 +1713,18 @@ def _get_app_settings(app):
|
|||
)
|
||||
try:
|
||||
with open(os.path.join(APPS_SETTING_PATH, app, "settings.yml")) as f:
|
||||
settings = yaml.safe_load(f)
|
||||
settings = yaml.safe_load(f) or {}
|
||||
# If label contains unicode char, this may later trigger issues when building strings...
|
||||
# FIXME: this should be propagated to read_yaml so that this fix applies everywhere I think...
|
||||
settings = {k: v for k, v in settings.items()}
|
||||
|
||||
# App settings should never be empty, there should always be at least some standard, internal keys like id, install_time etc.
|
||||
# Otherwise, this probably means that the app settings disappeared somehow...
|
||||
if not settings:
|
||||
logger.error(f"It looks like settings.yml for {app} is empty ... This should not happen ...")
|
||||
logger.error(m18n.n("app_not_correctly_installed", app=app))
|
||||
return {}
|
||||
|
||||
# Stupid fix for legacy bullshit
|
||||
# In the past, some setups did not have proper normalization for app domain/path
|
||||
# Meaning some setups (as of January 2021) still have path=/foobar/ (with a trailing slash)
|
||||
|
|
Loading…
Add table
Reference in a new issue