mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Stupid yolopatch for not-normalized app path settings >_> (#1141)
* Update app.py * Be more careful (c.f. _normalize_domain_path code ... maybe the path doesn't start with / either ..) * Annnnnd ignore case where path is '/' which is fine
This commit is contained in:
parent
b7293f33b9
commit
35a0711713
1 changed files with 13 additions and 1 deletions
|
@ -1892,6 +1892,18 @@ def _get_app_settings(app_id):
|
||||||
# If label contains unicode char, this may later trigger issues when building strings...
|
# 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...
|
# FIXME: this should be propagated to read_yaml so that this fix applies everywhere I think...
|
||||||
settings = {k: _encode_string(v) for k, v in settings.items()}
|
settings = {k: _encode_string(v) for k, v in settings.items()}
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
# resulting in stupid issue unless apps using ynh_app_normalize_path_stuff
|
||||||
|
# So we yolofix the settings if such an issue is found >_>
|
||||||
|
# A simple call to `yunohost app list` (which happens quite often) should be enough
|
||||||
|
# to migrate all app settings ... so this can probably be removed once we're past Bullseye...
|
||||||
|
if settings.get("path") != "/" and (settings.get("path", "").endswith("/") or not settings.get("path", "/").startswith("/")):
|
||||||
|
settings["path"] = "/" + settings["path"].strip("/")
|
||||||
|
_set_app_settings(app_id, settings)
|
||||||
|
|
||||||
if app_id == settings['id']:
|
if app_id == settings['id']:
|
||||||
return settings
|
return settings
|
||||||
except (IOError, TypeError, KeyError):
|
except (IOError, TypeError, KeyError):
|
||||||
|
@ -2423,7 +2435,7 @@ class YunoHostArgumentFormatParser(object):
|
||||||
|
|
||||||
if parsed_question.ask is None:
|
if parsed_question.ask is None:
|
||||||
parsed_question.ask = "Enter value for '%s':" % parsed_question.name
|
parsed_question.ask = "Enter value for '%s':" % parsed_question.name
|
||||||
|
|
||||||
# Empty value is parsed as empty string
|
# Empty value is parsed as empty string
|
||||||
if parsed_question.default == "":
|
if parsed_question.default == "":
|
||||||
parsed_question.default = None
|
parsed_question.default = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue