Pattern on path + check subfolder

This commit is contained in:
Kload 2013-03-02 00:17:45 +01:00
parent f60f616047
commit ccc0413a05
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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 }