From 87d9738c6d5dd0281540593c2a54a89ee9a7eb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 22:35:44 +0100 Subject: [PATCH] add path check --- scripts/install | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 25942f5..4cff6f0 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,7 @@ set -eu # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +path=${YNH_APP_ARG_PATH%/} admin_user=$YNH_APP_ARG_ADMIN # Setup variables app=$YNH_APP_INSTANCE_NAME @@ -20,6 +20,14 @@ FINAL_PATH="/var/www/$app" # Source app helpers . /usr/share/yunohost/helpers +# copy past from nextcloud package +if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then + path="/$path" +fi +if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then + path="${path:0:${#path}-1}" +fi + # Check user parameter if not empty if [[ $admin_user != '' ]]; then