diff --git a/action_map.yml b/action_map.yml index a1558440..9e55afab 100644 --- a/action_map.yml +++ b/action_map.yml @@ -267,11 +267,12 @@ app: -p: full: --path default: "/" + pattern: '^\/([a-zA-Z-_\/\.0-9])*$' -l: full: --label -m: full: --mode - help: level of protectness of the app (public|protected|private) + help: level of privacy of the app (public|protected|private) default: 'private' ### app_remove() TODO: Write help diff --git a/yunohost_app.py b/yunohost_app.py index 32963b3e..6b5b4aed 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -159,7 +159,6 @@ def app_install(app, domain, path='/', label=None, mode='private'): """ # TODO: Virer la règle "default" lemon # TODO: check path and url_to_(un)protect pattern - # TODO: check if app is installed on this domain/path (or subpath) with YunoHostLDAP() as yldap: @@ -206,6 +205,9 @@ def app_install(app, domain, path='/', label=None, mode='private'): if app_settings['path'] == path: raise YunoHostError(1, _("An app is already installed on this location")) + if app_settings['path'] in path and app_settings['path'].count('/') < path.count('/'): + raise YunoHostError(1, _("Unable to install app at this location")) + unique_app_id = manifest['yunohost']['uid'] +'__'+ str(instance_number) app_final_path = apps_path +'/'+ unique_app_id script_var_dict = { 'APP_DIR': app_tmp_folder }